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
60
Layout not the same following SaveAsXml/LoadFromXml
posted

Hi,

2008 volume 3 UltraGrid.

An earlier thread detailed a problem with the VisiblePosition property on a grid column not updating when the column's visible position within a grid is changed.  See the post "VisiblePosition of UltraWinGrid Columns Not Updating".

I have the same situation.  I have some code to save and restore the grid layout that relies on the VisiblePosition property.  The property doesn't seem to work so my code fails to lay the columns out correctly during deserialisation.

Here's some background:

I have an intialisation routine for the grid.  The initialisation routine does all the usual things including setting up a summary block to appear at the bottom of the grid and specifying the format of the data to appear on a row when it is a group-by row.

My serialisation code merely iterated the list of columns and saved and restored some of the attributes within - Key, Hidden, Width, VisiblePosition, IsGroupByColumn & SortIndicator.  There was no special code to save or restore the summary block or the group-by row information.


To overcome the problem with VisiblePosition, I've followed the advice in the earlier post and adapted my code to use UltraGrid.DisplayLayout.SaveToXml and UltraGrid.DisplayLayout.LoadFromXml.  This solves the problem.  Yipee!  BUT - it introduces two other problems that weren't present in my original implementation.


1. Generally speaking, if a column is selected for 'group-by', the text on each of the expandable rows contains the name of the column followed by the column value, the number of items in the group and some other information controlled by the programmer (see the note regarding initialisation above).

E.g. "+Boundary : D173DEBLO (1 item) <other information>" where the Boundary column is a group-by column and D173DEBLO is one of the values for that column.

With my old serialisation code, this format was mantained across the save/restore.

Using the DisplayLayout Save/Load methods, the group-by settings are maintained but the group-by rows are now missing the additional information, e.g. "+Boundary : D173DEBLO (1 item)". <other information> is missing.

2. Underneath the rows for the whole grid with no group-by or underneath the child-rows for each group-by row I had arranged for summary information to be displayed.  This summary information layout was maintained across my save/restore, but the summaries are missing following the DisplayLayout Save/Load.

I have verified that when re-loading a grid from Xml, the grid is first initialised and then the LoadFromXml method is called on the DisplayLayout member.

Is it expected behaviour that these two formatting setups are not saved and restored by the SaveToXml and LoadFromXml methods?
I was expecting that the load and save methods on the DisplayLayout member would save and load the complete layout, not just certain parts of it.
Can you offer any guidance as to what is considered 'best practice' regarding saving the layout of a grid and re-loading it later?

Regards
David Razzetti

Parents Reply Children
No Data