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?
RegardsDavid Razzetti
When you say a "custom summary", does that mean you are using a CustomSummaryCalculator?
The grid probably can't serialize your CustomSummaryCalculator into the file. I'm not sure if it actually tries to do so, but if it does, it would only work if the class implemented ISerializable. If not, then check the Summaries collection on the band and see if the summaries are actually there after the load. If so, you just need to re-attach the CustomSummaryCalculactor to the summary. If they are not there, you will need to re-create them.
Hi Mike,
We are using the 14.1 Infragistics Version and we are facing the same problem.We have a case where we are displaying three summaries. One summary is a default summary (count) and three are custom summaries.By saving the layout
and then reloading it
the three custom summaries disappear.
What can we do?
Best regardsIsidor S.
Got the solution. The datasouce was not set before loading the grid from xml.
Working great now.
Hi Mike ,
I am facing the same issue where the summaries are missing on loading/saving the application from the xml.
Do you have anty solution for this??
Thanks,
Ashish.
Hi David,
You don't HAVE to use a FilterCondition. I just wasn't sure what you meant by custom summary, exactly.
I just took a look and it appears that the grid is not attempting to serialized the CustomSummaryCalculator. This looks like a bug to me. If the instance is serializable, then it should be saved, I think.
I'm going to forward this post over to Infragistics Developer Support so they can write it up and get it looked at and hopefully fixed.