Triggering regenerate columns for table component with JS


I was wondering if it is possible to trigger a regeneration of a table's columns when a value is true in Retool. At the moment, I know you can do it manually with a click of the refresh button in the table component settings but I need to do it with JS.


1 Like


Javascript queries allow you to run other queries by using queryName.trigger(). See more info + examples here in our docs

.trigger() would be the same as the refresh button in that it is re-running your table query

One thing to keep in mind is that it only works in a Javascript query, not a Javascript transformer (transformers are read only and cannot call any actions).

I have kinda similar question.
I've switched from the legacy table component to the new one in my app. Users map columns from uploaded files to database columns, but the new table component ("Final table" in screenshot) doesn't auto-refresh column names after mapping, unlike the old one.

Any tips to achieve automatic column refresh in the new table component?

When using the queryName.trigger() The dataset is updated but the column headers are not in the table. Is this a bug?

If not, how do we call the table's "regenerate columns" functionality programmatically?

1 Like

Hey @Tess,

I appreciate your input.
It seems that the topic pertains to dynamically regenerating the column headers rather than the queried table data.

In the past, this was managed through dynamic column settings for the legacy table, which was quite nice.


It appears that table1.trigger() only refreshes the data. For scenarios where the incoming columns are not constant, it would be really cool if we could programmatically activate the button highlighted below.


Hi @rixlayer welcome to community.

Here is related topic about dynamic column of new table component for your ref.

1 Like

Hey @AnsonHwang, thank you. That thread was helpful.

Note to anyone else who can't get the dynamic columns working after toggling it on:
Toggle it off, clear existing columns, then toggle it back on.


Exactly that's my question. Is there a way to dynamically call the regenerate columns functionality?

Hi there! It looks like we're still working on a more native feature for auto regenerating table columns when using a dynamic data source :disappointed: I'll post here when it ships!

One possible solution is the dynamic column settings as discussed above (enabled by clearing existing columns, then toggling on dynamic column settings). Another option in the meantime (although potentially tedious to set up) is to have two tables in the same place on the cavas & then show/hide them dynamically

1 Like