I have a grid which we will add new columns to over time. I would like to use saveasxml and loadfromxml to preserve some basic user grid settings, such as the state of filters, column widths and positions and which columns are sorted and or hidden.
However, I have found that if I modify the datasource and add a new column, then when I loadfromlayout, certain settings of the new column; such as the position and column title get screwed up.
Is there any way around this, or any recommended practices for using saveasxml and anticipating future extensions to a grid. Or am I better off just preserving settings myself in some other mechanism.
Thanks
Yeah, you are basically correct. The column ended up in a different position (it ends up at the right-most end), and the title and width of the column that I had assigned were overwritten.
I did not realize you could load the layout into a layout var, I will try that, it sounds like a good solution.
Thanks.
What exactly happens to the new column?
My guess is that since the new column does not exist in the layout, the grid just ignores it and the VisiblePositions of the other columns and up getting set but the VisiblePosition on the new column is not set, so it's essentially arbitrary.
What you might want to do is load the layout into an UltraGridLayout variable, rather than directly into the grid. Then you could examine the loaded layout and look at it's columns and see if there are any columns in the data source that do not exist in the layout. Then you could try to modify the layout or the properties of the column to try to get it to show up in the position you want, either before of after loading the layout into the grid.