exclosion
09-11-2009, 08:48 AM
I have the following code. And this only allow me to display the region and revenue out. But the region are all list out in just one datagrid columns. Can anyone teach me how I can get the different region to be in different columns? What I mean is for example the revenue for the region Asia, to be in one column named Asia and maybe Europe's revenue to be all in another column named Europe. Please help me!Thanks..
<mx:XMLListCollection source="{srv.lastResult.list.month.region}" id="regionData"/>
<mx:DataGrid dataProvider="{regionData}" width="100%" height="100%" id="Dgrid" >
<mx:columns>
<mx:Array>
<mx:DataGridColumn dataField="@name" headerText="Month" width="100"
sortCompareFunction="sortByDates" sortable="false"/>
<mx:DataGridColumn dataField="@revenue" headerText="Calculated NAV" width="100" sortable="false" />
<mx:DataGridColumn dataField="" headerText="Asia" width="100" sortable="false"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
And this is my xml:
<revenuelist>
<list>
<month name="Dec-99" revenue="100">
<region name="Asia" revenue="100"/>
<region name="Emerging Markets" revenue="100"/>
<region name="Europe" revenue="100"/>
<region name="Latin America" revenue="100"/>
<region name="North America" revenue="100"/>
</month>
......
</list>
</revenuelist>
<mx:XMLListCollection source="{srv.lastResult.list.month.region}" id="regionData"/>
<mx:DataGrid dataProvider="{regionData}" width="100%" height="100%" id="Dgrid" >
<mx:columns>
<mx:Array>
<mx:DataGridColumn dataField="@name" headerText="Month" width="100"
sortCompareFunction="sortByDates" sortable="false"/>
<mx:DataGridColumn dataField="@revenue" headerText="Calculated NAV" width="100" sortable="false" />
<mx:DataGridColumn dataField="" headerText="Asia" width="100" sortable="false"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
And this is my xml:
<revenuelist>
<list>
<month name="Dec-99" revenue="100">
<region name="Asia" revenue="100"/>
<region name="Emerging Markets" revenue="100"/>
<region name="Europe" revenue="100"/>
<region name="Latin America" revenue="100"/>
<region name="North America" revenue="100"/>
</month>
......
</list>
</revenuelist>