Showing Summary with the Group Node

This example shows how AdvancedDataGrid can be configured to show summary with the Group node.

Here, I’m using GroupingCollection to calculate the Summary with summaryPlacement being “group”. Then using groupLabelFunction in AdvancedDataGrid and returning the Group Node’s value plus the Summary value.

Source mxml is located here.


16 thoughts on “Showing Summary with the Group Node

  1. sameer,

    i am trying to build a report using ADG and i have a scenario where i have to show another columns value on the summary.

    id name age dept
    1 x 30 Sales
    2 y 20 Sales
    3 z 25 Sales
    4 x1 30 HR
    5 y1 20 HR
    6 z1 25 HR

    i have to group the data by dept and i have to show the min age, that is fine…. but just next to min age how can i show the persons name who has the minimum age.

  2. Hi sameer….

    How can u make ur “From” column sort i.e it should sort group also along with flat data.

    For quite a while Iam looking for the solution…

    Thanks in advance

  3. Just make the Grouping label property same as the datafield of the column in which Group nodes are shown.
    Create the Grouping as –

    <mx:Grouping label="From">

  4. Hey sameer,

    Thanks man it worked my label property was not setting properly.
    Now iam able to set it properly and sort it.

  5. Hey sameer,

    iam using XMLListCollection(searchResultXMLColl) as my FlatDataProvider
    here goes the code…

    var sumRow:SummaryRow= new SummaryRow();
    var sumField1:SummaryField= new SummaryField(‘SPEND_PRE’,’SUM’);
    var sumField2:SummaryField= new SummaryField(‘SPEND_CUR’,’SUM’);
    gf = new GroupingField();
    grp = new Grouping();
    gc= new GroupingCollection2();
    gc.source = searchResultXMLColl;

    But one problem is like iam not able to calculate Summary?
    At the Summary Row it is showing 0
    earlier when I was using ArrayCollection as a source It was giving me accurate total.

    I am also using Itemrenderer(LinkButton) on my first column of dataGrid.The link button was coming fine and also the summary when the groupingCollection’s source was ArrayCollection
    But now iam not getting any summary except 0 and Itemrenderer is ignored and a simple text been diplayed at the first column.

    • You need to set the background property to true in the UITextField which is used in the AdvancedDataGridGroupItemRenderer and then set the backgroundColor property.

      Extend AdvancedDataGridGroupItemRenderer, override createLabel() method and set these properties to the label UITextField.

  6. Great example of the operation=”COUNT” function. There are almost no examples in the Flex documentation.

    Thank you!

  7. If it is with the HierarchicalData how can we reach this approch?

    below is the example of my code..

    .myCPStyle {

    background-color:#D6C097, #E7D2A7;

    openIcon: Embed(source=”upArrow.png”);
    closedIcon: Embed(source=”downArrow.png”);


    • Do you already have Hierarchical data and want to add summaries to it? Well summaries are only supported if GroupingCollection is used.

      Well, somehow your code couldn’t make it through. Can you try again.

  8. I have an ADG with souce is an ArrayCollection (flat source), and its grouping by name and sum the values. I need to filter it, using a slider, and must show only totals where the sum is between the slider range.

    Can you help me please?

    Thank you


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s