<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:c="component.*"
layout="absolute" xmlns:local="*">
<mx:Script>
<![CDATA[
[Bindable]public var initDG:Array = [
{year:2006, t1:"t12", t2:"t33", test1:new MultiRowVO("a1","b1"), data1:new MultiRowVO("d1","t1"),data2:new MultiRowVO("df","wef")},
{year:2007, t1:"t13", t2:"t43", test1:new MultiRowVO("a2","b2"), data1:new MultiRowVO("d2","t2"),data2:new MultiRowVO("df","wef")},
{year:2008, t1:"t14", t2:"t53", test1:new MultiRowVO("a3","b3"), data1:new MultiRowVO("d3","t3"),data2:new MultiRowVO("df","wef")},
{year:2009, t1:"t15", t2:"t63", test1:new MultiRowVO("a4","b4"), data1:new MultiRowVO("d4","t4"),data2:new MultiRowVO("df","wef")},
{year:2010, t1:"t16", t2:"t73", test1:new MultiRowVO("a5","b5"), data1:new MultiRowVO("d5","t5"),data2:new MultiRowVO("df","wef")}
]
]]>
</mx:Script>
<mx:AdvancedDataGrid id="dataGrid" dataProvider="{initDG}" sortExpertMode="true" width="100%" height="100%">
<mx:groupedColumns>
<mx:AdvancedDataGridColumn headerText="year" dataField="year"/>
<mx:AdvancedDataGridColumn headerText="test1" dataField="test1">
<mx:itemRenderer><mx:Component><local:rowVBox propertyName="test1"/></mx:Component></mx:itemRenderer>
</mx:AdvancedDataGridColumn>
<mx:AdvancedDataGridColumn headerText="data1" dataField="data1">
<mx:itemRenderer><mx:Component><local:rowVBox propertyName="data1"/></mx:Component></mx:itemRenderer>
</mx:AdvancedDataGridColumn>
<mx:AdvancedDataGridColumn headerText="data2" dataField="data2">
<mx:itemRenderer><mx:Component><local:rowVBox propertyName="data2"/></mx:Component></mx:itemRenderer>
</mx:AdvancedDataGridColumn>
</mx:groupedColumns>
</mx:AdvancedDataGrid>
</mx:Application>
-- rowVBox.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" verticalGap="0">
<mx:Script>
<![CDATA[
[Bindable] private var _propertyName:String;
[Bindable] private var mydata:Object;
public function set propertyName(p:String):void {
this._propertyName = p;
}
public function get propertyName():String {
return this._propertyName;
}
public override function set data(value:Object):void {
mydata = value;
}
]]>
</mx:Script>
<mx:Label text="{mydata[propertyName].p1}" width="100%" height="20" textAlign="center"/>
<mx:HRule width="100%"/>
<mx:Label text="{mydata[propertyName].p2}" width="100%" height="20" textAlign="center"/>
</mx:VBox>