How to get column title using script?

Hello, any solution to get column title with script, I use {{self}}, but it don't work.
In my picture, I want to get the value id with script.

Thanks

@AnsonHwang - If you don't put anything in the Column title field, it will render the name of the column in your data. Is this what you are trying to do?

Hello, I know this. But I want to get the name of the column in programming way.
If I can get the column name, I will use it in dynamic column tiltle name setting.
such as

Thanks.

Hi @AnsonHwang, the column names are actually coming from your query data. If you're looking to grab the column names of your table, then you can open up your left-panel and grab that data from {{ table1.columns }}. Here's a screenshot of what that looks like:

Hope this helps!

Hello, Thanks for your reply. But I can't grab the column name within column setting, becuase I have no method to get squence no. as you metioned above table1.columns[squence no]

@AnsonHwang, since your column names are coming form your query, are you able to create a transformer and put the column names into an array for your use case? That way you can reference your column names anytime you would like. Here's an example of what that would look like:

Thanks for reply.
It's good idea to get all colums. But how to get the corresponding index, such as 0, 1, 3... in the {{}}

image

What I want to do is to change Column title by getting it's origin column name or column index number.

:thinking: this is a tricky one. Would it be possible to transform your data before passing it to your table? Something like {{ _.mapKeys(formatDataAsObject(query.data), (value, key) => yourNamingFunction(key) }}