Hello
I have a grid which has a number of columns and group by is allowed. I have the following problem I cannot solve:
I drag a couple of columns to the outlook group by bar and grouping is performed fine. One of the columns in the grid is editable (meaning I can enter a value in the cell(s)). When I change the value in a cell in that column, an engine runs to recalculate the values displayed in the grid. After the recalculation, the datasource is cleaned and repopulated (fyi, we use two datasources, one temp and one that is the one bound to the grid, alternating depending on which one is bound, so the datasource population does not affect the grid, until the population is complete at which time the datasources are swapped, for efficiency).
The problem is that I need to find a way to regroup the grid the way it was before the repopulation of the datasource. Any ideas how to do this?
Many thanks,
Kostas.
You will have to come up with some way to store information unique ot the row. GetHashCode won't work for the same reason that storing the row won't work - the row won't be there after you rebind the grid, it will be a completely different row object.
You may be able to use the Value property of the GroupByRow - that's the value of the cell being grouped.
Hi
I am working on the same problem, but how exactly can I save "some key" value, because a row, which a groupbyrow has no cells attached. I have tried with gethashcode, but that does not work.
Hi Mike,
Thanks for replying back. I am doing same thing now and could achieve it.
Regards,
Sulakshana.
Hi Sulakshana,
If your grid is being reset, then the rows no longer exist. All rows are destroyed and a completely new set of rows is created. So no, the grid cannot maintain the expanded state of the rows.
You could loop through all the rows and store the expanded state based on some key values and then loop through and resotre the expanded state yourself, but the grid cannot do this.
Is there any way, I can identify/ retain the previous expansion state for grid rows?
In case, User has expanded a row to see it's child rows, next time I want to retain the same expansion state when I fetch new data in grid.
Thanks for your help.
-Sulakshana.