Programmatically Toggling Column Visibility Inside a Table

Hey there!

In one of my apps, I had a situation where I needed to play around with different sets of custom fields within a table and switch between them seamlessly.

Something like this (video).

I managed to pull it off, but I have to admit, the way I did it doesn't feel very reusable. I had to go column by column in the table and tinker with the 'Hidden' parameter, as shown here:

So, here's the deal – I'm wondering if there's a smoother way to handle this. My ultimate goal is to write a single trigger that kicks into action when a specific field changes. It should then update the field visibility in the table. Ideally, I'd like to keep all the logic in one place, without messing with the table itself. Got any tips?

Hello there!

If your table data structure is always the same then you could just program each app with the list of columns to show, then in the hidden input on each column, you can dynamically hide the column if it's missing from that list. See the "request link" column in the attached "static hidden columns" app for an example. This sounds similar to what you currently have?

If the columns present in the data will actually be different between apps, then you would need to leverage dynamic column settings! There does seem to be an issue with the dynamic column when first configuring it. It looks like you need to set dynamic column, set {{item}} as the dynamic column Label input, clear all of the existing columns on the table and then reload the page. See the attached "dynamic column (1)" app for an example.

Let me know if this helps unblock you!
dynamic-20columns (1).json parent-20app3-20module.json