<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="creationCompleted();">
<mx:Script>
<![CDATA[
import mx.collections.HierarchicalData;
[Bindable]
private var hierarchyData : HierarchicalData;
public var myXML : XML = <data>
<users
country="New Zeland">
<player name="Andy Flower" age="25" sex="M"/>
<player name="Grant Bin" age="75" sex="M"/>
</users>
<users
country="Australia">
<player name="Rakesh Singh" age="32" sex="F"/>
<player name="Alex Shen" age="42" sex="F"/>
</users>
</data>;
private function creationCompleted () : void {
hierarchyData = new
HierarchicalData(myXML.users);
}
]]>
</mx:Script>
<mx:AdvancedDataGrid
id="dataGrid"
x="100" y="200"
width="30%" height="30%"
dataProvider="{ hierarchyData }"
displayItemsExpanded="true"
>
<mx:columns>
<mx:AdvancedDataGridColumn
headerText="Name"
width="40"
dataField="@name"
/>
<mx:AdvancedDataGridColumn
headerText="Age"
width="40"
dataField="@age"
/>
<mx:AdvancedDataGridColumn
headerText="Sex"
width="40"
dataField="@sex"
/>
</mx:columns>
</mx:AdvancedDataGrid>
</mx:Application>
This is my code. I want the country to be shown as the root of every
node. NZ and Australia in the above case.
Can someone please help..!
Thanks.
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.