Saving the content of a nested dataview with a custom Save button

6
For one of my projects, I needed some more complex behaviour so I replaced the default 'Save' button with a custom Save button that saves the root dataview. When using this construction, the content of a nested dataview is not saved, which would be the case if I would have used the default 'Save' button. What causes this difference in behaviour?
asked
4 answers
3

Michel

I have now solved the problem, I was not using a custom save button however the issue was around the 'create object' property. My nested Data Grids did not have the property set, I have since set these properties to true and can now commit associated objects in a microflow.

answered
7

If you use a custom invoke button for saving your dataview you can only give the object in the dataview in which the button is placed as parameter or the object of its enclosing dataview.

Possible solutions:

  • Place the button in the nested dataview and to set the 'pass enclosing context' property to true. In this way the object of the enclosing dataview is also passed as parameter to your microflow.

  • Place the button in the parent dataview and retrieve the nested dataview's object in the Microflow using 'retrieve by association'. In that way you retrieve the object from the Mendix Runtime's memory instead of the database. It will contain all changes done in the client. You can now manipulate and save the object in the way you want.

answered
1

I have just come across the same issue, I have tried to solve the problem using your second solution Johan. However each nested object that I attempt to retrieve through the 'retrieve through association' activity returns a null value. Have you any idea why this may be happening?

answered
0

Oliver,

Do you use the standard Mendix 'new' button or did you create your own?

If the latter, you probably need to create the object yourself before you can retrieve it over association.

I have some issues with the property 'create object' though, but more information will follow on our forum here

answered