Simple Datagrid In Flex

A DataGrid is a formatted table whose items can be edited and displayed via custom renderers.

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” creationComplete=”onCreate(event)”>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
private var Values:ArrayCollection=new ArrayCollection([
{Company:”Google”,Feature:”Mail / Search Engine/Social Network”},
{Company:”Yahoo”,Feature:”Mail /Search Engine”}
]); //Creating an Array Collection with “Company and Feature as Identifiers 


private function onCreate(e:Event):void
{
DG.dataProvider=Values;  // Assigning “Values” Arraycollection as a Dataprovider to DataGrid, “Comany” and “Feature” are considered automatically to be the column names for Datagrid
}
]]>
</mx:Script>
<mx:DataGrid x=”10″ y=”21″ width=”388″ height=”220″ id=”DG”>
</mx:DataGrid>
</mx:Application>

Output

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.