3.2.0

Grid remembers selected rows even after refresh

When I call setUrl to refresh my data, the grid remembers which rows where selected before the refresh and highlights the same rows after the refresh. I don't think this is a good thing!

How can I make sure that all rows are "unselected" when I refresh the data?
Jeremie
March 3,
Jeremie,

the grid keeps its state in a set of data models/properties independent of the HTML structure. You should be able to re-create HTML at any time calling 'toString' method (as 'refresh' method does). So calling 'refresh()' should not change control state.

To clear the selected row(s) you can just do

obj.setProperty("selection/index", -1);
Alex (ActiveWidgets)
March 4,
Alex,

thanks for the tip. I will make sure I unselect the row but I do think that this should be the default behavior since when refresh is called, new data may be fetched and displayed on the grid and keeping the state does not make sense. What if row 9 was selected before the refresh and only 5 rows are present in the grid after the refresh?
Jeremie
March 4,
The data model should not only call refresh method on the grid, but clear the selection when the new data is fetched?
Alex (ActiveWidgets)
March 9,
I understand your desire to keep the different model seperate and I don't want to be telling which model should be doing what. All I'm saying is that it doesn't make sense for the rows to be selected after a refresh if we know that the refresh can cause the data to be different.
Jeremie
March 13,

This topic is archived.

See also:


Back to support forum