Wednesday, April 15, 2009

Displaying XML contents in a datagrid

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:DataGrid x="114" y="92" dataProvider="{sampleXML.product}">
<mx:columns>
<mx:DataGridColumn headerText="NAME" dataField="name"/>
<mx:DataGridColumn headerText="PRICE" dataField="price"/>
<mx:DataGridColumn headerText="AVAILABILITY" dataField="availability"/>
</mx:columns>
</mx:DataGrid>
<mx:XML xmlns="" id="sampleXML" format="e4x">
<items>
<product>
<name>A</name>
<price>1234</price>
<availability>Yes</availability>
</product>
<product>
<name>B</name>
<price>5678</price>
<availability>Yes</availability>
</product>
<product>
<name>C</name>
<price>910</price>
<availability>NO</availability>
</product>
</items>
</mx:XML>
</mx:WindowedApplication>

No comments:

Post a Comment