You can achieve this with a simple custom preference setup:
- Create an entity called UserColumnPreference to store each user's column selections.
- User
- Column Name
- Visible (Yes/No)
- Add a custom button on the page (for example, "Select Columns").
- When clicked, open a popup.
- In the popup, show all available Data Grid 2 columns with checkboxes.
- Checked = Show the column.
- Unchecked = Hide the column.
- When the user clicks Save Preferences:
- Save the selected columns in the UserColumnPreference entity.
- Refresh the object(s) used in the column visibility expressions so the UI updates immediately.
- Close the popup.
- In Data Grid 2, use the saved preferences to control the visibility of each column.
- Keep all columns in their original order and only show or hide them based on the user's preferences. This ensures the default column order remains unchanged.
With this approach, each user can choose which columns they want to see, their preferences are saved for future logins, and the grid updates immediately after clicking Save Preferences without requiring a page refresh.