Flex 3 AdvancedDataGrid Summary Divider

The AdvancedDataGrid (ADG) control in Adobe Flex 3 extends the capabilities of the standard DataGrid control to improve data visualization. You can:

  • Sort by multiple columns when you click in the column header
  • Use the styleFunction property to specify a function to apply styles to rows and columns of the control
  • Use an expandable navigation tree in a column to control the visible rows of the control
  • Collect multiple columns under a single column heading
  • Span multiple columns with an item renderer and use multiple item renderers in the same column

Working in a combination of these features to create something new was fun. I wanted to create a summary row for a group, but I didn’t want any of the tree structure to be shown. More like a divider between my grouped data. Here’s the basic example:

I started out with just a simple ADG that grouped by a column. Grouped data is flat data that you arrange in a hierarchy for display.

To group data, you specify one or more data fields that collect the data into the hierarchy using the GroupingCollection class as the dataProvider for the ADG. The refresh() method applies the settings of the GroupingCollection class to the data. You must call this method any time you modify the GroupingCollection class. Since I was calling a groupingFunction to group my data, I call refresh() on initialize of the ADG.

By default, GroupLabel is the field name for the data items added to the flat data to create the hierarchy. We’ll use this for our summary row divider.

That gave me a tree structure in the display. Next I added a renderProvider

I’m going to go ahead an post this up, I should be able to complete the rest of the description later.

About Rob Rusher

In his role as Principal Consultant for On3, Rob leads an software development practice to help his clients build rich Internet applications for the desktop, browser, and mobile devices, and to rapidly increase their knowledge and skills to better support their organization's goals. Rob is an Adobe Certified Expert, Community Professional, and Certified Instructor. He has taught and mentored the technical teams at HP, Overstock, Paychex, SAS, the FedEx, and other Government and Fortune 100 organizations. Rob has co-authored four best-selling books on building secure, cutting-edge and rapidly developed applications using Adobe AIR, ColdFusion and Flex. He is very active in organizing and speaking at RIA, Adobe LiveCycle, mobile conferences, and user groups. In addition to growing his software consulting practice, On3, Rob has been building expertise in rich client application development on a wider variety of devices and platforms that extend the applications to change the way we all create and live.