Persist Show/Hide Columns setting on a table

I was wondering if anyone had an elegant solution to storing user settings for show/hide columns on a table. My idea was to attach an ENUM per table in the app to my extended User object and then use the occurrence of the column names in the enum to control the Initially Visible setting on the table.

This means I would have to reimplement the built in “show/hide column” selection and the number of ENUMS could potentially become pretty high.

If anyone has done anything similar or has any ideas it would be appreciated. :slight_smile:

Hi,

Is it a specific property of the User that determines if the column is visible or not?

If not, could you clarify what property determines if the column should be visible? :sweat_smile:

I want to save what columns the user would like to see or not on a table in our app on a per user basis. And have the users themselves select which columns they see. Much like the built in show/hide columns toolbar function. The only difference would be the app remembering your choices between sessions.

I see! In this case, I would create a new object in the object class where you have a boolean property for each column and a property connected to the User.

This object should be database connected with cardinality one and should be filtered on the current user. Hence, when a user is logged in, you can use this object to toggle which columns should be visible.

Let me know if I should explain this in more depth :slightly_smiling_face:

Just to clarify as this feature is not very easy to find: on each column in a table you can define Conditional Column Properties. This lets you set up a condition to decide whether a column should be initially hidden or not. It is briefly covered in the docs

Other than that, you can follow the approach outlined by Ulrik, but you will have to set up your own UI for the users to control which columns should be visible.

Thank you both. That is what I was failing to describe in my original post.

I still think an enum per table inside the user config datasource will be tidier than a datasource per table with bools. We will see if I think so after implementing :smiley:

1 Like