<?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">
<mx:Script>
<![CDATA[
[Bindable]public var initDG:Array = [
{title:2006, test1:new MultiRowVO("aa","bb"), data1:new MultiRowVO("123","456"),data2:new MultiRowVO("df","wef")},
{title:2007, test1:new MultiRowVO("aa","bb"), data1:new MultiRowVO("123","456"),data2:new MultiRowVO("df","wef")},
{title:2008, test1:new MultiRowVO("aa","bb"), data1:new MultiRowVO("123","456"),data2:new MultiRowVO("df","wef")},
{title:2009, test1:new MultiRowVO("aa","bb"), data1:new MultiRowVO("123","456"),data2:new MultiRowVO("df","wef")},
{title:2010, test1:new MultiRowVO("aa","bb"), data1:new MultiRowVO("123","456"),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="data1" dataField="data1" id="data1" itemRenderer="co"/>
<mx:AdvancedDataGridColumn headerText="data2" dataField="data2" id="data2" itemRenderer="tttt"/>
<!--<mx:AdvancedDataGridColumn headerText="data2" dataField="data2">
<mx:itemRenderer>
<mx:Component>
<mx:VBox width="100%" height="100%" verticalGap="0">
<mx:Label text="{data.data2.p1}" width="100%" height="20" textAlign="center"/>
<mx:HRule width="100%"/>
<mx:Label text="{data.data2.p2}" width="100%" height="20" textAlign="center"/>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:AdvancedDataGridColumn>-->
</mx:groupedColumns>
</mx:AdvancedDataGrid>
</mx:Application>
-- co.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:Label text="{data.data1.p1}" width="100%" height="20" textAlign="center"/>
<mx:HRule width="100%"/>
<mx:Label text="{data.data1.p2}" width="100%" height="20" textAlign="center"/>
</mx:VBox>
-- tttt.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:AdvancedDataGridItemRenderer xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
override public function set data(data:Object):void{
if(data != null){
p1.text = data.p1;
p2.text = data.p2;
}
}
]]>
</mx:Script>
<mx:VBox width="100%" height="100%" verticalGap="0">
<mx:Label id="p1" text="{data.data1.p1}" width="100%" height="20" textAlign="center"/>
<mx:HRule width="100%"/>
<mx:Label id="p2" text="{data.data1.p2}" width="100%" height="20" textAlign="center"/>
</mx:VBox>
</mx:AdvancedDataGridItemRenderer>