Datagrid selection lost after client refresh

8
We've made a grid that supports user sorting (internally we use a sortId and some custom microflows to enable sorting behavior). Now the following may happen: User selects a row in a grid; User presses the 'sort up' or 'sort down' button which trigger the corresponding microflows; The microflow have the option 'refresh in client' selected; The client refreshes, the sorting of the list is changed; The problem now is that the selected row in the grid is not selected anymore, which is quite annoying for the user because he has to select the row each time he wants to put it up or down. Does anyone have (simple) a solution for this? Perhaps we should use Javascript. On the other hand: shouldn't the Mendix client remember the selected row, even when a data refresh occurs? Thanks!
asked
3 answers
8

One of the issues to keep in mind with tracking grid selections is that you can keep items as selected even though you have moved on to another page.

The default behaviour for the DataGrid in the client is to drop the selection list after invoking a MicroFlow. This is done because there is no way to guarantee the consistency of the selection list after arbitrary actions have been performed on the server. For example,

  • Attribute changes can affect the order of objects if sort parameters are a factor so the current page of the grid might contain completely different data after an update.
  • Objects that the MicroFlow was invoked on might be deleted. Whether or not this has actually occurred can't be determined using the paged return set of objects after an update.

In addition, the requirements in use cases we've encountered thus far have matched this behaviour. For adding new behaviour I'd suggest filing a feature request. Your question documents the case nicely, so for the most part you can probably just copy/paste it into the description.

answered
2

The problem is indeed annoying, and occurs in template grids as well. I suggest filing a bug report for it in the partner portal.

(Note that the explorer pane from the appstore does remember the selection while sorting, however it might not suit your case, for example it does not support paging).

answered
0

I am also facing the issue. Is there any work around or feature request for this issue?

answered