Define array with Array collection in ActionScript and use it for DataGrid : DataGrid Data « Grid « Flex






Define array with Array collection in ActionScript and use it for DataGrid

Define array with Array collection in ActionScript and use it for DataGrid
       

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="creationCompleteHandler(event)">
    <mx:Script>
        
            import mx.collections.ArrayCollection;

            private function creationCompleteHandler(event:Event):void {
                var array:Array = new Array({city: "A", state: "CA",population: 3},
                                            {city: "B", state: "NY",population: 8},
                                            {city: "C", state: "IL",population: 2},
                                            {city: "D", state: "PA",population: 1});
                var collection:ArrayCollection = new ArrayCollection(array);
                grid.dataProvider = collection;
            }

      
    </mx:Script>
    <mx:DataGrid id="grid" width="500" />

</mx:Application>

   
    
    
    
    
    
    
  








Related examples in the same category

1.Get data from DataGrid in drag enter eventGet data from DataGrid in drag enter event
2.Fill data from DataGrid to Form fieldsFill data from DataGrid to Form fields
3.Update data in DataGrid from Form fieldsUpdate data in DataGrid from Form fields
4.ArrayCollection used as the data source for DataGridArrayCollection used as the data source for DataGrid
5.Inline data provider for DataGridInline data provider for DataGrid
6.Passing data to a DataGrid controlPassing data to a DataGrid control
7.Get data from selected row in DataGridGet data from selected row in DataGrid
8.Get DataGrid data providerGet DataGrid data provider
9.Remove data from DataGridRemove data from DataGrid
10.Get the returning data from Php and feed it into DataGridGet the returning data from Php and feed it into DataGrid
11.Update Chart data as DataGrid being updatedUpdate Chart data as DataGrid being updated
12.Modifying data in a DataGrid controlThe following example lets you add, remove, or modify data in a DataGrid controlModifying data in a DataGrid controlThe following example lets you add, remove, or modify data in a DataGrid control
13.DataGrid data with Simple AttributesDataGrid data with Simple Attributes
14.DataGrid and DataGrid and <mx:ArrayCollection>
15.DataGrid with object array collectionDataGrid with object array collection