Skip to content

Instantly share code, notes, and snippets.

@sugamasao
Created February 3, 2010 01:55
Show Gist options
  • Save sugamasao/293256 to your computer and use it in GitHub Desktop.
Save sugamasao/293256 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init()">
<mx:DataGrid x="64" y="42" id="dataGrid">
<mx:columns>
<mx:DataGridColumn headerText="列 1" dataField="color"/>
<mx:DataGridColumn headerText="列 2" dataField="cpu"/>
<mx:DataGridColumn headerText="列 3" dataField="drive.c"/>
<mx:DataGridColumn headerText="列 4" dataField="drive.d"/>
</mx:columns>
</mx:DataGrid>
<mx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
private var xml:XML = <xml>
<spec>
<color>red</color>
<cpu>すごい</cpu>
<drive>
<c>ハードディスク</c>
<d>CDROM</d>
</drive>
</spec>
<spec>
<color>black</color>
<cpu>しょぼい</cpu>
<drive>
<c>SSD</c>
<d>DVDROM</d>
</drive>
</spec>
</xml>;
private function init():void {
dataGrid.dataProvider = new XMLListCollection(xml.spec);
}
]]>
</mx:Script>
</mx:Application>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment