Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
275
Remembering grouby state before grid refresh
posted

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. 

  • 469350
    Verified Answer
    Offline posted

    Hi Kostas,

        It sounds like what you are doing to the data source is going to cause the grid to get a Reset notification. This means you are going to lose a lot of state information in the grid, not just the groupings. You will lose the column widths, expanded rows, selected rows, and other things, too. 

        You can use the grid.DisplayLayout Save and Load methods to save the layout to a file or a stream and then reload it after your operation is complete. This will handle the column positions, sizes, and groupined, but it cannot save any row-level state information like selection or expansion.