DataGrid2 not able to save config

1
Hi all, I'm facing issue with Datagrid2 to not be able to save config. I tried both way of saving config: Onchange - Save changes and also with microflow and what is strange even if I use microflow and place breakpoint inside it never get into debugger. Also DataGrid2 is inside DataView
asked
5 answers
0

Hi Slavko,

 

If I may give you some suggestions, try doing the following:

 

  1. Add an entity 'DatagridConfig' and give it a 1 on 1 association with the Account entity.
  2. Give the DatagridConfig entity a new attribute, make sure this is of type 'String' with length set on 'Unlimited'.
  3. Above your DataGrid2, place a DS Microflow to retrieve the current user account.
  4. Within your DataGrid2, in the personalization tab, select the right attribute, being something like: Account_DatagridConfig/DatagridConfig/{YourAttribute}.
  5. For the On change action, select 'Call a nanoflow' (since this is client side).
  6. Make sure the Nanoflow has the 'Account' object as an input parameter.
  7. Within the Nanoflow, first add the following retrieve action: $Account/Account_DatagridConfig to check whether there is already a DatagridConfig object associated with the account.
  8. Next, add a decision which checks if the retrieved object is empty or not.
  9. If the object is empty, create a new DatagridConfig object and associated it with the $Account. Make sure you commit the object.
  10. If the object is not empty, add a commit action of the DatagridConfig object.

 

This should work.

 

If you need any more help, feel free to reach out. 

answered
0

Hey Slavko,

 

I would follow this approach, assuming you had created an entity that contains an unlimited string attribute, and an association with the Account Entity ( System.User). Let's call this entity DataGridConfig, with an attribute Config(unlimited string).

 

  1. Wrap your Datagrid2 with a DataView with type source Microflow.
  2. In this microflow you:
    1. Retrieve Current User/Account.
    2. Retrieve DataGridConfig from database using: [ModuleName.DataGridConfig_Account/Administration.Account/id=$CurrentUser]
    3. Use a Decision action to check if the DataGridConfig exists.
    4. If it exists, return it. If it doesn't, create a NewDataGridConfig and set the Account Member with the $CurrentUser, finally returning this recently created object.
  3. In the DataGrid2 you select the "Config" attribute by association with the dataview, and on change you "save changes".

 

 

Microflow:

 microflow.png

DataGrid2:

 

datagrid2.png

That works for me, hopefully, it's helpful. Let me know if you have any questions.

answered
0

Hey Slavko,

 

It was the Mendix Issue I faced the Same issue, so I upgraded the Mendix version then it worked.

 

PLease upgrade mendix version and try. Hopefully it will work.

answered
0

Interesting discussion! I have the same problem in mendix 10.3.1. reorganizing my page is not an option unfortunately becausemy parent entity is in a listview and for each parent entity there is a datagrid that shows the children. I tried wrapping the pagelayout entity around different levels but none of them wordked. Also tried save changes instead of the nanoflow. 

Is there anyone who knows if this issue is known with mendix and will solve itself?

 

 

answered
0

There's 2 things you need to consider:

1) The attribute that is used to store the configuration needs write access

2) If the datagrid is wrapped inside another data container, e.g. a dataview or a listview make sure that it has "Editable" set to "Yes". Note that if you use nested data containers, the Editable settings get inherited from the parent, so you may need to change the setting there. 

 

HTH

answered