• Home
  • /Posts Tagged 'AdvancedDataGrid'

Posts Tagged ‘AdvancedDataGrid’

Dynamically resize nested Flex List with variableRowHeight

Another quick post…

I was stuck recently with a Flex component that had a List with an itemRenderer. The itemRenderer contained another List with an itemRenderer. Now the problem with this is that the data had unique counts and the lists had variable row heights (variableRowHeight = true). The result was that containers would not dynamically resize enough to display the whole List. In other words, the List was clipped and vertical scroll bars were displayed.

After trying several ways to get it to resize correctly and failing miserably, I extended the List component. As I was doing this, I found another post about an AutoSizingAdvancedDataGrid by the guys at WorkDay in which they had similar issues with the AdvancedDataGrid. Since the AdvancedDataGrid is similar to the List, I only had to make a couple of changes to get it working with the List component.

Once I get approval from my client, I’ll post the AutoSizingList. But until then… see the WorkDay post and their example. Thanks for the post khurram.

Finally able to post the code:

Get Adobe Flash player

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.