views:

218

answers:

0

So I want to have the tree behavior in a grid, and use item renderers in the top-level (aka summary) rows. Once I've applied grouping, the data object is much changed.

Here is the code to add grouping to an ADG:

var tripCollection : TripSearchMatchCollection = TripSearchMatchCollection(value); 

var theGroupingCollection : GroupingCollection = new GroupingCollection();
theGroupingCollection.grouping = new Grouping();
theGroupingCollection.grouping.fields = new Array();

var newGroupingField : GroupingField = new GroupingField('rideID');
theGroupingCollection.grouping.fields.push(newGroupingField);
newGroupingField = new GroupingField('memberID');
theGroupingCollection.grouping.fields.push(newGroupingField);

theGroupingCollection.source = tripCollection;
Grid.dataProvider = theGroupingCollection; 
Grid.validateNow();      
theGroupingCollection.refresh();

So I'm grouping on a combination of rideID and memberID.

Whereas previous to grouping, the item renderer's

override public function set data(value : Object) : void

received a single member of the tripCollection as 'value', and I could cast it to the actual class and access its properties, now I get an Object that has the original data buried down several levels of subproperties named children and [0].

I assume that the layering is a way to show what grouping field values are controlling the row, but I cannot find any documentation on how to get the original object out from the depths.

Any ideas?