Make multiple selections from Datagrid and edit the data all at once.

Make multiple selections from Datagrid and edit the data all at once. And I want to select a category from the pull-down menu and set it to all in the list. I understand that I can pass the selected list in the datagrid to microflow. But then I don't know how to let the user select a category, get that category and put it in the list. Should the popup be displayed in the 'Show page' activity in Microflow? In that case, how do I keep the list selected in Datagrid? I am a beginner of mendix, so please tell me in detail. Thank you in advance.
2 answers

I’d say something like this:

  1. Create a non-persistable entity BulkEditHelper with a many to many association to the entity you have in the list and the same enum attribute Category
  2. Add an action button to the datagrid toolbar calling a microflow
  3. In the microflow, you have a list input parameter to receive the selected items. Create a BulkEditHelper, add the list to the association and show a popup
  4. In the popup you have a dataview with the BulkEditHelperwhere you can set the Category. You could also retrieve the list by association to show the user what objects they’re about to change
  5. Add a microflow button to call a microflow with the BulkEditHelper as input parameter. Retrieve the list again by association, loop over it to change the Category to the chosen Category of the BulkEditHelper. Then commit and refresh the list and close the popup

Hi Chika,

You could do the following:

  1. Create a non persistent entity and associate it to the entity (the details of which you show in datagrid) so a 1-* association.
  2. This non persistent entity should have your category either in the form of enumeration if its static or another association to your NPE if its stored in an entity of its own.
  3. When the user clicks on multiple objects in the datagrid and clicks on the button → write custom logic in the called microflow
  4. In the microflow, a parameter to pass the list selected from the datagrid, and create an object of your non persistent entity and associate all the details. Pass this NPE object to the page where you can select the category inside the dataview.
  5. On this page another button to process your data where you could loop through all the associated objects and set the category.

If you’ve not already taken a course from Mendix academy, go ahead and take them, it will benefit a lot as such concepts are included:

In case you don’t know what is NPE take a look at this →

Hope this helps