How to force all summaries to recaculate in a WinGrid when a cell value changed?
Sorry about the confusion.
When I said "import" i set the values in the code. But the Summary values aren't updating automatically.
It was suppose to be SummaryType.Formula not Custom (big mistake from my part). I have a couple SymmaryType.Sum and couple SummaryType.Formula...all Sum work and none of the Formla works. All works when I i change a value in the grid but not in the collection.
And I have the latest hotfix. (v8.1.20081.1000)
Manually forcing refresh:
foreach (SummarySettings setting in dgPOI.DisplayLayout.Bands[0].Summaries) { setting.Refresh(); }
Works with manual refresh (SummaryType.Sum):
SummarySettings summary = dgCategory.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Sum, dgCategory.DisplayLayout.Bands[0].Columns["Weight"]); summary.DisplayFormat = "{0:0.00}";
Does not work with manual refresh (SummaryType.Formula):
summary = dgCategory.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Formula, dgCategory.DisplayLayout.Bands[0].Columns["MPRIndex"]); summary.Formula = "sum([mprIndexCalc]) / sum([MPRIndex])"; summary.DisplayFormat = "{0:0.0}";
Hi Axel,
What exactly do you mean by "'import' a saved set of values into a column"? Are you setting the cell values in code? If so, then the summaries should be updating automatically. If they are not, I'd say it's a bug in the grid.
Also, what exactly do you mean when you say "Custom" summaries? I assume this means you are using an ICustomSummaryCalculator. In which case, when you call Refresh on the SummaryValue, the method of the ICustomSummaryCalculator should be called again to calculate the summary value. If this is not happening, then it's a bug.
Do you have the latest Hot Fix?
If a value of a cell in the grid changes and it affects a summary, then the summary is automatically updated. You should not need to do anything.
However, there is a Refresh method on the SummarySettings which will force a recalculation.