Home > Uncategorized > Flex Advanced Data Grid changes in BETA2

Flex Advanced Data Grid changes in BETA2

Hello All,
Flex 4 and Flash Builder4 BETA2 have introduced a lot of changes in both the SDK and the IDE. One significant improvement in the SDK (Data-Visulaization component) is the introduction of new Grouping Collection called GroupingCollection2 (GC2) and SummaryField2 (SF2).

Why GC2?

The primary motivator for this change is to improve the performance of Grouping Collection and Summary Generation.

What’s NEW in the GC2 ?

1) A new AS class GroupingCollection2 is introduced which implements a new ‘refresh()’ method from IGroupingCollection2. This refresh method would be slightly different from the existing refresh() in IGroupingCollection in a way that it adds an event ‘dispatchCollectionEvents’ as another parameter.

So the syntax now looks like:

function refresh(async:Boolean = false, 
dispatchCollectionEvents:Boolean = false):Boolean;

This event is basically an optimization that is introduced to speed up the process of grouping. While true, there will be an event dispatched by the internal collection when a group is made and the user can listen and update things.

The syntax to use GC2 will be similar to GC in all ways and one would also get hinting at MXML and AS level.

2) A new class called ‘SummaryField2’ (SF2) .

The fundamental change here is the introduction of a new method ‘summaryOperation’ which would replace both ‘operation’ and ‘summaryFunction’ which existed in SummaryField.


Earlier the summaries were calculated after the groups formation process was completed which resulted in issues when grouping asynchronously as the groups were getting formed but the summaries became available only in the end.

So, now the summaries will be calculated as and when each group is formed.

Now, the ‘summaryOperation‘ can take values like ‘COUNT’,’AVG’,’SUM’,’MIN’,’MAX’ (as operation in the SummaryField1) and a Custom Summary Calculator.

To add a custom SummaryCalculator one must implement a new interface  ‘ISummaryCalculator‘ and assign it to summaryOperation as:

 <mx:SummaryField2 dataField="name" 
   summaryOperation="AVG" />
 <mx:SummaryField2 dataField="sal" 
   summaryOperation="{new MyCustomSummaryCalculator()}" />

FYI, I shall provide a sample Custom Summary Calculator in my subsequent post.

Do I need to change my existing code to update to GC2?

Absolutely NOT 🙂 We maintain backward compatibility by retaining existing GC as it is.

Here is a small snippet of the GC2 with SF2:

<mx:GroupingCollection2 id="gc" source="{ac}">
    <mx:GroupingField name="name">
	   <mx:SummaryField2 dataField="name" 
               summaryOperation="MIN" />
	    <mx:SummaryField2 dataField="salary" 
               summaryOperation="{new MyNewCustomSummaryCalculator()}" />

Please use the new GroupingCollection2 and provide us your 
 valuable feedback :)
Hope you guys cherish the new improvement.

 Thank You!
Categories: Uncategorized
  1. Tom G
    October 9, 2009 at 2:35 pm

    So glad Adobe is finally listening about much needed DMV updates. Is this available for Flex 3.5 or just Flex 4?

    • Balaji Sridhar
      October 9, 2009 at 4:18 pm


      As of now it is available in Flex4. I do not have any data if it would be available in 3.5 too. As soon as i get to know the details would definitely share with you.

  2. October 9, 2009 at 4:58 pm

    Great to see these optimizations have been made!

    But I am pretty disturbed with class names like “SummaryField2”. I hope these ones will be refactored? As my experience tells, developers really don’t like such names.

  3. January 5, 2010 at 8:35 pm

    Thanks…I have one question that is bothering me though.

    I use SummaryField to pass in a field name, and then I set “operation” to a formula like…


    This varies by column (they all have different aggregation formulas, as different rates and metrics do). I need something more than SUM, AVG, MIN, and MAX clearly.

    Finally, I set the “summaryFunction” to a function something called aggregationCalculator, which parses the “formula”, replaces fieldnames {} with real values, performs the aggregate calculation, then returns the result.

    How is this even possible with SummaryField2? I would need to have a custom summary class for every single type of formula or calculation?

    With my current implementation, I can create new columns and formulas on the server side (API) and the flex app simply takes them, and runs them. No need to release an update to add new fields – a very important characteristic of our application.

    • Balaji Sridhar
      January 6, 2010 at 10:36 am


      Can you please send a sample of your use case the way you use it with SummaryField so that i can tell you how it could be used with SuammryField2?

  1. No trackbacks yet.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

%d bloggers like this: