Category: Widget
Resource links
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Adding Columns That Are Shown/Hidden Programmatically

Issue

I am trying to add a button to a table in my app, where users can select which columns they want to see. However, the button is not working and I am not sure how to make it show the selected columns. Additionally, I want the columns to be hidden by default and only shown when the user clicks the button, but this doesn't seem to be working either. I am looking for a solution to make this feature work in my app.

Resolution

To add a button that allows users to show or hide selected columns in a table, you can use the storeValue() function in the onClick event of the button to save a boolean value in the Appsmith store. Then, use this value in the Visible property of the column to show or hide it programmatically. Here is a sample app that shows how to programmatically show a column.

You can also use a Multiselect widget instead of a button to allow users to select which columns to show or hide.