Easy bug to reproduce. I'm using the SaveCustomizations/LoadCustomizations API to serialize the grid state and reload it. Now I've added several custom summary calculators to my grid.
When I Load the state of the grid all of the fields with custom summaries now are using the "Sum" summary calculator instead of the custom one.
I examined the xml output by the SaveCustomizations API and it is serializing the Calculator as "Sum" which is obviously not correct.
This bug makes it impossible to use both features simulataneously.
<
igDP:FieldLayout.SummaryDefinitions>
<igDP:SummaryDefinition SourceFieldName="Oface"
Calculator="{x:Static local:TBAShorts.SelectedSum}"
StringFormat="{}{0:#,#;;0}"/>
<igDP:SummaryDefinition SourceFieldName="Qty"
StringFormat="{}{0:#,#.##;;0}"/>
<igDP:SummaryDefinition SourceFieldName="MTG_WACPN"
Calculator="{x:Static local:TBAShorts.SelectedAverage}"
StringFormat="{}{0:0.##}"/>
<igDP:SummaryDefinition SourceFieldName="MTG_WAM"
<igDP:SummaryDefinition SourceFieldName="MTG_WAOLTV"
</
ouput of SaveCustomizations():
<summaries> <SummaryDefinition SourceFieldName="Oface" StringFormat="{0:#,#;;0}" Calculator="Sum" /> <SummaryDefinition SourceFieldName="Qty" StringFormat="{0:#,#.##;;0}" Calculator="Sum" /> <SummaryDefinition SourceFieldName="MTG_WACPN" StringFormat="{0:0.##}" Calculator="Sum" /> <SummaryDefinition SourceFieldName="MTG_WAM" StringFormat="{0:0.##}" Calculator="Sum" /> <SummaryDefinition SourceFieldName="MTG_WAOLTV" StringFormat="{0:0.##}" Calculator="Sum" />
</summaries>
My custom calculators, which derive from SumSummaryCalculator
SumSummaryCalculator
{
record)
)
)record).DataItem;
(item.IsSelected)
)dataValue * item.Weight, summaryResult, record);
}
.Aggregate(dataValue, summaryResult, record);
Hello,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Hi, I tweaked your example to more closely reflect how I'm using it. When you click on Save the xml looks good, but when you click on Load to invoke LoadCustomizations it blows away the summary.
I have been looking into the modified sample and I can say that the SummaryCalculator should be registered as I did in the commented lines if you want the Save/Load functionality to work as expected.
Hope this helps you.
Yes that worked. My problem was I didn't override the Name property in my custom SummaryCalculator class which caused in base name to be serialized, and also I had to register the summarycalculator as you mentioned.
Thanks for the hints!
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Hi Stefan,
I tried your sample with follownig steps
1) Save Layout
2) Remove Summary
3) Load Layout
I was expecting the custom summary to be reloaded after step -3 but it is not loading up. Please see the attached "Steps to reproduce".png.
I have attached the sample project which is using Infragistcs 14.1 libraries.
Could you please suggest work around to acheive this behaviour
Thanks,
Sandeep
Please ignore my response. Got it working.