2 Replies Latest reply on Sep 1, 2009 2:31 AM by dam.C

    Displaying row count with Group In ADG grouping


      Hi All,
              Is it possible to show row count at Group level in ADG ie I want
      to show no of row count at each level of grouping.

      For Example :-

             Asia (2)
                  - India
                  - China
             Europe (3)
                   - France
                   - Itely

      I am thinking  of using filtering to acheive this but  it would be great
      if there is easy to way  for it.



        • 1. Re: Displaying row count with Group In ADG grouping
          _Natasha_ Level 4


          of course it's possible.


          You can create a custom itemRenderer and add a field to show data.children.length() there. It's the best variant.

          1 person found this helpful
          • 2. Re: Displaying row count with Group In ADG grouping
            dam.C Level 1

            Hi Natasha,

                Thanks for the  suggestion.

            I have found the simplest  way to do it. just need to provide implementation  of groupLabelFunction of ADG


            <mx:AdvancedDataGrid id="adg"    groupLabelFunction="addChildCount">



                private function addChildCount(data:Object,column:AdvancedDataGridColumn):String
                   //get the groupingCollection to get access to the group label property name
                    var grp:IGroupingCollection = tradeList.dataProvider.source as GroupingCollection2;
                    var grpLabelProperty:String = grp.grouping.label;
                    //get child count for the group
                    // this uses the fact that IHierarchicalData supplied as dataProvider to ADG gets
                    // converted to a IHierarchicalCollectionView. This converts all children to ICollectionViews if they are not already.                   
                    var childCount:int = tradeList.dataProvider.getChildren(data).length;
                    return data[grpLabelProperty] + "(" + childCount + ")";


            Thats it ...


            Hope this will help someone ..