I am having a problem maintaining the wingrid layout and focus on a row after I refresh the data.
I am using a parent grid which is read-only and child grid which is editable. The parent grid has grouping functionality and users will typically have three bands grouped (three levels of grouping). A row is then selected in the parent grid which then returns rows to the child grid, a row is updated in the child grid which updates a cell in the matching row of the parent grid. When the data is refreshed I lose focus on the row in the parent grid because the grid collapses all the rows. I never delete any rows only edit rows in the child grid which updates a cell in the parent grid. After the refresh I need to return/keep focus on the row in the parent grid whilst maintaining the users layout.
Has anyone had this problem and solved it? Any help is appreciated.
Hi Andy, thanks for the response.
I saved the rowindex before the refresh and then tried to re-select it afterthe data was reloaded.Unfortunately, when it refreshes, the groups are all collapsed and the Rowsproperty becomes only the GroupBy rows (e.g. if the grid has 100 rows ofdata and you then groupby something, the number of rows reduces down to theno. of grouped rows.)So when I tried to re-select the rowindex, it wasn't there.
The users will group their data differently, so how do I guarantee that I expand back to the highlighted row they were busy with prior to the refresh?
Thanks
Hi,
If you have a reference to the row in the read-only grid you could use these commands. Depending on the final outcome you're after you may not need them all.
Assuming the row in the read-only grid is row ...
ultraGrid1.DisplayLayout.RowScrollRegions[0].ScrollRowIntoView(row);
row.Expanded = true;
row.Activate();
row.Selected = true;
Andy.