How to store list of values in Datagrid2

0
Hello, I have datagrid2 table with list of values shown below: I want to save this list of Checked values for each user profile using “Personalization” feature in datagrid2. How can I achieve this? Everytime user changes this check box then I want to save this change in the user profile. (datasource type used for this grid is via association)
asked
2 answers
2

Hi,

  • Enable Personalization for the Data Grid in Mendix Studio Pro.
  • Create an entity named "UserProfileSettings" with attributes "User" (Association to System.User entity) and "CheckedValues" (String).
  • Implement a microflow to save user profile settings:
    • Input: User (System.User entity), CheckedValues (String)
    • Output: UserProfileSettings (UserProfileSettings entity)
    • Retrieve the UserProfileSettings entity for the given User, if it exists.
    • If the UserProfileSettings entity exists, update the CheckedValues attribute with the new checked values. If it doesn't exist, create a new UserProfileSettings object and set its attributes.
    • Commit the changes.
  • Implement a microflow to retrieve user profile settings:
    • Input: User (System.User entity)
    • Output: CheckedValues (String)
    • Retrieve the UserProfileSettings entity for the given User, if it exists.
    • If the UserProfileSettings entity exists, return its CheckedValues attribute. If it doesn't exist, return an empty string.
  • Add a microflow call on checkbox change in the Data Grid that triggers the Save User Profile Settings Microflow.
  • When the Data Grid loads, use the Retrieve User Profile Settings Microflow to fetch the previously saved settings for the current user.
  • If the microflow returns any CheckedValues, set the checkboxes in the Data Grid accordingly.
answered
0

Hi Raghavendra Bhagwat,

 

For this, I use a non-persistent Entity. The Microflow that is that data source of the Grid2 prepares an association between Evaluation and a NewEvaluationHelper.

 

 

This allows me to create a list of EvaluationHelperSelected by retrieving all selected EvaluationHelper. The entity UserEvaluation I use to store that list, when required by selecting the “Save Evaluation” button. The system is Looping over the EvaluationHelperSelectedList to create the association between MyEvaluation and Evaluation. I use MyEvaluation and the associated Evaluation to recreate the Grid2 and set the EvaluationHelper.Selected boolean to true when the association is present.

 

Go Make It

answered