Home Tutorial Flex Flex-components DataGrid in Flex

 
 

DataGrid in Flex
Posted on: January 20, 2010 at 12:00 AM
In Flex, DataGrid is a kind of list which can display more than one column in tabular form and we can sort the fields on a specific column.

Adobe Flex DataGrid:

In Flex, DataGrid is a kind of list which can display more than one column in tabular form and we can sort the fields on a specific column.

Adobe Flex DataGrid provides many features like columns can be resized, sort, customized at run time by the user, selection events, rows and columns can be locked and can not be scrolled.

We need to use <mx:DataGrid> tag in MXML section. Like other components of Flex we can provide an id so we can access it from any other part of the file or from other ActionScript file.

We need to specify the data source by <mx:dataProvider> tag , with subtags like <mx:ArrayCollection> and <mx:Object> tags.

Adobe Flex Datagrid Example 1:


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Panel width="400">
<mx:DataGrid width="100%" textAlign="center">
<mx:Array>
<mx:Object>
<mx:Technology>
Flex
</mx:Technology>
<mx:Company>
Adobe
</mx:Company>
</mx:Object>
<mx:Object>
<mx:Technology>
SilverLight
</mx:Technology>
<mx:Company>
MicroSoft
</mx:Company>
</mx:Object>
<mx:Object>
<mx:Technology>
JavaFx
</mx:Technology>
<mx:Company>
Sun
</mx:Company>
</mx:Object>
<mx:Object>
<mx:Technology>
GWT
</mx:Technology>
<mx:Company>
Google
</mx:Company>
</mx:Object>
</mx:Array>
</mx:DataGrid>
</mx:Panel>
</mx:Application>


Output:

Related Tags for DataGrid in Flex:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.