Datagrid refresh after adding new item in reference set

1
I have a datagrid with companies and below this datagrid a dataview with a reference set selector of locations of these companies. I have made a custom button to add a new location to this reference set. But when saving this new location it is not direct visible in the reference set. I tried already the java action from the community commons to force the refresh of the datagrid. Selecting an other company and then back to the one where I added a new location did not give the right result. The only way to show this new location in the reference set is by closing the form and reopening it. I must be doing something wrong here. How can I force the datagrid to refresh?
asked
3 answers
2

Are you sure the actual Java actions are in place? Sometimes people misplace them. I just had a look at the community module and the code in refreshClass.java should contain something like this:

// BEGIN USER CODE
ORM.refreshClass(this, objectType);
return true;
// END USER CODE

And which entity type are you passing in this action? Which entity you have to refresh may depend on which entity is the owner of the association, as that is the place where the association is stored.

answered
0

The microflow timer widget v1.2 did the trick if the start at once option is set to true. When the new location is made in content then after the closing of this screen the widget is triggered again and the screen refreshes.

But I really would like to know if I also could have done it with the jave refresh action. I hope someone of Mendix can give an axample on a string that refreshes a reference.

answered
0

It is not possible to refresh a member directly. If there is an entity (+ xpath) is the source of the grid, then refresh that entity. If the source of the grid is a path, I think that refreshing the parent/context object should do the trick. But I am not sure about the latter one.

e.g: [Datagrid: Entity : B, xpath : [bladibal = bla]] -> AddrefreshClass("MyModule.B")

[Datagrid: Source : myassoc/myentity ] -> Refresh the context object

Interesting question, maybe someone should test it using a really simple project :)

answered