Hi!
I'm using the following functions to save and load filters:
private const PropertyCategories CategoriesToSave = PropertyCategories.ColumnFilters; public override void AdditionalSave(Control x, string path) { var g = x as UltraGrid; var layout = g.DisplayLayout; var newpath = string.Format("{0}{1}_gridProps.lyt", path, g.Name); layout.Save(newpath, CategoriesToSave); } public override bool AdditionalLoad(Control x, string path) { bool ret = true; var g = x as UltraGrid; var layout = g.DisplayLayout; var newpath = string.Format("{0}{1}_gridProps.lyt", path, g.Name); if (File.Exists(newpath)) { layout.Load(newpath, CategoriesToSave); } return ret; }
The Load of the grid resets the other properties of the grid (for example ExcludeFromColumnChooser). This is not desirable in my situation. I was fully expecting the loading of filters to be merely additive with no other impact on the grid. Can you explain how I can achieve this?
Thanks!
Craig
Egad, sorry about the formatting of my comment after the code. Here's that text again hopefully not formatted as code:
Hi,
You can't save the filters without also saving the columns. So any properties of the columns will also be saved and loaded along with this code. I'm not sure exactly what you mean when you say "reset". If the ExcludeFromColumnChooser property that is being loaded is something different from when it was saved, then something is wrong.But I've never seen anything like that happens.
If you want more fine control over what is loaded, then one thing you could do is... don't load the layout directly into the grid's DisplayLayout. You can create an UltraGridLayout variable in code and load your layout into that variable. Then you would have to loop through the ColumnFilters and copy them (re-create them) in the grid's DisplayLayout.