AdvancedDataGrid with With Hierarchical Data
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="600" height="300" >
<mx:Script>
import mx.collections.ArrayCollection;
[Bindable]
private var grocerySalesData:ArrayCollection = new ArrayCollection([
{Grocer:"A", Category:"Fruits", Item:"Apple", Q1:15, Q2:10},
{Grocer:"B", Category:"Fruits", Item:"Pineapple", Q1:17, Q2:15},
{Grocer:"B", Category:"Meats", Item:"Pork", Q1:43, Q2:43}
]);
</mx:Script>
<mx:AdvancedDataGrid id="myAdvancedDG"
width="100%" height="100%" >
<mx:dataProvider>
<mx:HierarchicalData source="{grocerySalesData}" childrenField="childMembers"/>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="Grocer"/>
<mx:AdvancedDataGridColumn dataField="Category"/>
<mx:AdvancedDataGridColumn dataField="Item" headerText="Product(Item)"/>
<mx:AdvancedDataGridColumn dataField="Q1"/>
<mx:AdvancedDataGridColumn dataField="Q2"/>
</mx:columns>
</mx:AdvancedDataGrid>
</mx:Application>
Related examples in the same category