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.
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?
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 there! It looks like we're still working on a more native feature for auto regenerating table columns when using a dynamic data source 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