Is there a way to dynamically hide columns?

Hello,

I am trying to dynamically hide columns in a table that a lot of queries belong to when the queries run. Is this possible to do with event handlers inside the query instead of in the table column itself?

Thanks!

Hello,

are you trying to use same table component for multiple queries?

First I need to know, if you will re-run the query that is about to be display? If yes, you can use query.reset()


So say you have 2 queries, you need to display query2 then you need to do:

query1.reset()
query2.trigger()

that will set query1.data to null
image
Now you can hide columns that belong to query1 when data is null/undefined

If you don't want to reset other queries, then just use a temporally state to store current active query by add an event handler to update the temp state's value on success. THEN you hide when value of the temp state when active query is not what the columns are for. This is the only option since you can't update the hidden value of the column via JS.

Hope that helps.

1 Like