Customize column selection and hiding unwanted colmns as per logged in users preference in datagrid 2

0
Hi Experts,Hope you are doing good!I want to make logged in user able to click a action button ( Not the mendix provided eye button ) which will show popup with the list of columns so he can select the column which he want to view in datagrid 2 after clicking save the preferences button on column selection pop.PS - Columns should be in the same default order.Thanks in advance for all the suggestions.
asked
2 answers
1

Hi Modi,


  1. Add a custom Action button.
  2. On click, open a popup page.
  3. In the popup, show all available columns as checkboxes.
  4. Store the user's selections in a persistent entity (User Preferences).
  5. When the user clicks Save, refresh the page/grid.
  6. Use visibility expressions for each Data Grid 2 column based on the saved preferences.
  7. Keep the columns in the grid's original order and only hide/show them.


I hope this helps.

answered
1

You can achieve this with a simple custom preference setup:

  1. Create an entity called UserColumnPreference to store each user's column selections.
    • User
    • Column Name
    • Visible (Yes/No)
  2. Add a custom button on the page (for example, "Select Columns").
    • When clicked, open a popup.
  3. In the popup, show all available Data Grid 2 columns with checkboxes.
    • Checked = Show the column.
    • Unchecked = Hide the column.
  4. 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.
  5. In Data Grid 2, use the saved preferences to control the visibility of each column.
  6. 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.

answered