Binding XML to DataGrid : DataGrid « Grid « Flex






Binding XML to DataGrid

Binding XML to DataGrid
         

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
            import mx.collections.XMLListCollection;
      
    </mx:Script>
    
        <mx:XML id="itemData" xmlns="">
            <items>
                <item id='1'>
                    <name>Name 1</name>
                    <type>Type 1</type>
                    <description>Desc 1</description>
                </item>
                <item id='2'>
                    <name>Name 2</name>
                    <type>Type 2</type>
                    <description>Desc 2</description>
                </item>
            </items>
        </mx:XML>
    <mx:DataGrid width="200" dataProvider="{new XMLListCollection(itemData..item)}">
        <mx:columns>
            <mx:DataGridColumn dataField="name" />
            <mx:DataGridColumn dataField="type" />
        </mx:columns>
    </mx:DataGrid>
</mx:Application>

   
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Scroll DataGridScroll DataGrid
2.Set selected index for DataGridSet selected index for DataGrid
3.Variable row heightsVariable row heights
4.Multi-line data grid rowMulti-line data grid row
5.variable scope for DataGridvariable scope for DataGrid
6.Creating inline item renderer and editorCreating inline item renderer and editor
7.Using a DataGridUsing a DataGrid
8.Formatting grid lines with CSSFormatting grid lines with CSS
9.Set editing position for DataGridSet editing position for DataGrid
10.Append new value to DataGrid from Form fieldsAppend new value to DataGrid from Form fields
11.Item click event for DataGridItem click event for DataGrid
12.Editable DataGridEditable DataGrid
13.Variable row height DataGridVariable row height DataGrid
14.DataGrid change eventDataGrid change event
15.Use Panel to layout controls and hold DataGridUse Panel to layout controls and hold DataGrid
16.DataGrids take a dataProvider to populate themDataGrids take a dataProvider to populate them
17.Default setting for DataGridDefault setting for DataGrid
18.Call HTTP server and set result to DataGrid
19.DataGrid Configuration through ActionScriptDataGrid Configuration through ActionScript
20.DataGrid Validate NowDataGrid Validate Now
21.DataGrid Validate Now Selected indexDataGrid Validate Now Selected index
22.DataGrid with static string valuesDataGrid with static string values
23.DataGrid DataDataGrid Data
24.DataGrid EventsDataGrid Events
25.Sort a DataGridSort a DataGrid
26.Inline DataGrid Image ScopeInline DataGrid Image Scope
27.Print DataGrid outPrint DataGrid out
28.Enabling the user to move many items at onceEnabling the user to move many items at once
29.data provider contains fields for an artist, album name, and price.data provider contains fields for an artist, album name, and price.