:: Forum >>

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
Wednesday, March 3, 2004
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)
Thursday, March 4, 2004
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
Thursday, March 4, 2004
The data model should not only call refresh method on the grid, but clear the selection when the new data is fetched?
Alex (ActiveWidgets)
Tuesday, March 9, 2004
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
Saturday, March 13, 2004

This topic is archived.


Back to support forum

Forum search