The user can return to the default List view by selecting a reset button at top of grid

0
Hi ,   In Data grid2  20 custom columns  , 4 Column default   If I select Multiple columns as per my requerment   when I the click the reset button it will  show default columns only   explain how to implement microflow logic        
asked
1 answers
0

Hi Sajjina,

 

I think this reads like a ChatGPT promt, so I tried :)

 

In Mendix, the scenario you're describing involves managing the visibility of columns in a Data Grid 2 widget. You have a Data Grid 2 with a total of 20 custom columns and 4 default columns. You want to allow users to select multiple columns based on their requirements, and then have a reset button that will show only the default columns when clicked. This can be achieved using microflows and conditional visibility settings. Here's how you can implement this logic:

1. **Set Up the Data Grid 2:**

   - Add the Data Grid 2 widget to your page.
   - Configure the columns by adding the default columns and the 20 custom columns. For each column, give it a unique name and set the appropriate data source.

2. **Creating a Boolean Attribute for Column Visibility:**

   - In your domain model, create a boolean attribute for each column that you want to control visibility for. For example, create attributes like `ShowColumn1`, `ShowColumn2`, and so on.

3. **User Selection and Reset:**

   - On your page, place the checkboxes or any other elements that allow users to select columns.
   - Create a boolean attribute for each checkbox that corresponds to a custom column. For instance, if you have 20 custom columns, create 20 boolean attributes like `ShowCustomColumn1`, `ShowCustomColumn2`, and so on.
   - Users will use these checkboxes to select the columns they want to see.

4. **Microflow for Reset Button:**

   - Create a microflow that is triggered when the reset button is clicked.
   - In this microflow, set the boolean attributes for custom columns (`ShowCustomColumnX`) to `false` for all custom columns.
   - This will hide all the custom columns when the reset button is clicked.

5. **Conditional Visibility:**

   - For each column in the Data Grid 2 widget, set up conditional visibility based on the boolean attributes you created in step 2 and step 3.
   - For the default columns, you can use the boolean attributes you created for them. For example, if you have `ShowColumn1`, set the visibility condition for the corresponding column in the Data Grid 2 widget to `[$EntityName/ShowColumn1]`.
   - For custom columns, similarly, set the visibility conditions based on the boolean attributes you created for each checkbox. For example, if you have `ShowCustomColumn1`, set the visibility condition for the corresponding column in the Data Grid 2 widget to `[$EntityName/ShowCustomColumn1]`.

Now, when users select custom columns using the checkboxes, the corresponding boolean attributes will be set to `true`, making the columns visible. Clicking the reset button triggers the microflow, which sets all the custom column visibility attributes to `false`, thus showing only the default columns.

Remember to replace `$EntityName` with the actual entity that you're using in your domain model.

Please note that Mendix might have gone through updates or changes after my last knowledge update in September 2021. Always refer to the latest Mendix documentation or community resources for the most up-to-date information.

curious if this is working out

answered