Hi,
I have a problem by saving and loading layouts of a hierarchical ultragrid.I set a filter in a child band and save the layout with grid.DisplayLayout.Save(layoutStream, PropertyCategories.All)When I try to load this layout again with grid.DisplayLayout.Load(layoutStream, PropertyCategories.All)the filter doesn't appear.Is there a possibilitiy to save filters of child bands?
(You can reconstruct this in your samples "WinGrid - Samples Explorer - Loading and saving layouts":First you have to allow RowFiltering. Then set some filter in the second band of the left grid (for example quantity = 1). After pressing "Swap" the filter has to appear on the right grid - but it doesn't)I hope you understand my problem and can help me.
ThanksJulia
Hi Julia,
Are other settings getting loaded properly? If you change the width or position of a column, does that load properly?
If no settings are loaded properly, then my guess is that you are loading the layout into a grid whose data structure is different from the one you save. The bands and columns have to be exactly the same in order to load a layout.
Another possibility is that this is a bug that was recently fixed and you should get the latest service release to correct the issue.
If the column widths and positions are working okay and it's just the filters, then my guess is that this has to do with the RowFilterMode. If RowFilterMode is set up to filter all the rows in a particular band, then that's okay. But if it is set up to filter each rows collection separately, then the filters cannot be saved, because they are dependent on the data and are not part of the layout.
Hi Mike,
I'm facing the same problem using the version 10.2:
Result: The rootband's settings are loaded properly including all columnfilters which were set in the rootband. The settings of any childband are also loaded properly except the columnfilters which get lost for all the childbands. Using SaveAsXml and LoadFromXml have the same effect. I've searched in the saved Layout-file for the ComparValues which I used for my filters, but I could only find the CompareValues from the rootband's filters. It seems to be a bug...
Actually, this is correct behavior.
By default, the grid filters each row island individually. In other words, when you apply a filter to a set of child rows, the filter only applies to those rows under the same parent row. These filters are stored on the rows collection. Since they are on the rows collection, they cannot be saved as part of the layout, because the layout cannot save the data. So it cannot save anything on the row or cell level, it can only save properties and settings that apply to the bands or columns.
You can change the filtering behavior by setting the RowFilterMode property to AllRowsInBand. This makes the filters apply to the entire band and not just the rows collection. Thus the filters are stored on the band and not on the rows collection and they can be saved (and loaded) with the layout.