Custom Summary Calculator for Grouping Collection 2
Here is a small implementation of custom summary calculator which can be used with SummaryField2 in GroupoingCollection2 of Advanced data grid.
Most of us know that the default summary calulations are SUM, MAX, MIN, AVG and COUNT.
With the new Grouping Collection one can add a custom summary calculator to calculate the summary of a field.
A sample snippet to illustrate the use is as shown:
var summField:SummaryField2 = new SummaryField2(“price”, new MySummaryCalculator());
var summField:SummaryField2 = new SummaryField2(“price”);
summField.summaryOperation = new MySummaryCalculator();
Here, MySummaryCalculator is the custom summary calculator which implements ISummaryCalculator.
Please find the MySummaryCalculator
and the corresponding Flex code with grouping collection
(Look for ADGGC2Test.mxml and MySummaryCalculator.as in the linked site)
The summary calculator here generates the Summary as a PRODUCT of the values in the datafield.