View comments | RSS feed
Methods | Properties | Effects | Events | Styles | Examples Frames | No Frames

mx.controls
Class DataGrid

Inheritance ImageInheritance ImageInheritance ImageInheritance ImageInheritance ImageInheritance Image


class DataGrid
extends mx.controls.List

The DataGrid control is a List that can show more than one column of data.

The DataGrid control provides the following features:

The DataGrid is intended for viewing data, and not as a layout tool like an HTML table. The mx.containers package provides those layout tools.

MXML Syntax

The <mx:DataGrid> tag inherits all the properties of its parent classes, and the following properties:

 <mx:DataGrid
cellEditor="No default."
cellRenderer="No default."
columns="No default."
columnName="No default."
dataProvider="No default."
editable="false|true"
focusedCell="No default."
headerColors="[0xE6EEEE, 0xFFFFFF]"
headerHeight="20"
headerStyle="No default."
hGridLineColor="#666666"
hGridLines="false|true"
resizableColumns="true|false"
rollOverColor="#0xE3FFD6"
selectable="true|false"
selectionColor="#0xCDFFC1"
showHeaders="true|false"
sortableColumns="true|false"
vGridLineColor="#666666"
vGridLines="false|true"
cellEdit="Event handler; no default."
cellFocusIn="Event handler; no default."
cellFocusOut="Event handler; no default."
cellPress="Event handler; no default."
columnStretch="Event handler; no default."
headerRelease="Event handler; no default."
>
Following is a DataGrid sample Code Specifying the Column Order:
<mx:DataGrid>
<mx:dataProvider>
<mx:Array>
<mx:Object Artist="Pavement" Price="11.99"
Album="Slanted and Enchanted" />
<mx:Object Artist="Pavement"
Album="Brighten the Corners" Price="11.99" />
</mx:Array>
</mx:dataProvider>
<mx:columns>
<mx:Array>
<mx:DataGridColumn columnName="Album" />
<mx:DataGridColumn columnName="Price" />
</mx:Array>
</mx:columns>
</mx:DataGrid>

Click here to view the Examples

See Also
    gridclasses.DataGridColumn
    gridclasses.DataGridRow
    mx.effects.Tween
    mx.managers.CursorManager



Methods
       addColumn( newCol) :  mx.controls.gridclasses.DataGridColumn
Appends a column to the end of the DataGrid.
       addColumnAt( index: Number, newCol) :  mx.controls.gridclasses.DataGridColumn
Adds a column at the specified index.
       draw( )
Creates the headers, draws the rows and cells, then sizes and draws the column headers.
       editField( index: Number, colName: String, data) :  Void
Updates the value of a cell in a column with new data.
       getColumnAt( index: Number) :  mx.controls.gridclasses.DataGridColumn
Returns a column at a specified location.
       getColumnIndex( name: String) :  Number
Get the index of a specified column based on the column name.
       getRowMetrics( ) :  Object
Same as the getViewMetrics() method, but factors in the headerHeight.
       layoutChildren( ) :  Void
Sizes and positions the column headers, columns, and cells based on the size of the DataGrid.
       measure( )
Measures the DataGrid based on its contents, summing the total of the visible column widths.
       placeSortArrow( ) :  Void
Draw the sortArrow graphic on the column that is the current sortIndex.
       removeAllColumns( ) :  Void
Removes all columns.
       removeColumnAt( index: Number) :  mx.controls.gridclasses.DataGridColumn
Removes a column at the specified location.

Methods inherited from class mx.controls.listclasses.ScrollSelectList
addItem   addItemAt   calculateWidths   clearSelected   createChildren   draw   fillRowsFromBottom   fillRowsFromTop   getDropLocation   getItemAt   hideDropFeedback   isSelected   layoutChildren   measure   removeAll   removeItemAt   replaceItemAt   setPropertiesAt   showDropFeedback   sortItems   sortItemsBy  

Methods inherited from class mx.core.ScrollView
childLoaded   createChildren   createChildWithStyles   getViewMetrics   init   layoutChildren   setScrollProperties  

Methods inherited from class mx.core.View
childLoaded   constructObject2   createChild   createChildren   destroyAllChildren   destroyChild   destroyChildAt   draw   getBorderMetrics   getChildAt   getChildIndex   getViewMetrics   init   layoutChildren   layoutChrome   setChildIndex  

Methods inherited from class mx.core.UIComponent
drawFocus   getFocus   getFocusManager   setEnabled   setFocus  

Methods inherited from class mx.core.UIObject
addEventListener   applyProperties   buildDepthTable   commitProperties   constructObject2   createAccessibilityImplementation   createChildAtDepth   createChildren   createClassChildAtDepth   createClassObject   createEmptyObject   destroyObject   dispatchEvent   doLater   draw   drawRect   executeBindings   fillRect   findNextAvailableDepth   getRepeaterItem   getStyle   handleEvent   init   invalidate   invalidateLayout   invalidateProperties   invalidateSize   invalidateStyle   layoutChildren   measure   move   redraw   removeEventListener   setDepthAbove   setDepthBelow   setMask   setSize   setSizeNoLayout   setStyle   swapDepths  



Properties
       cellEditor: MovieClip
A reference to the cell editor, if it exists.
       columnCount: Number    [Read-Only]
Number of columns that can be displayed.
       columnNames: Array
An array of strings used to generate the column headers.
       columns: Array
An array of DataGridColumns, one for each visible column
       editable: Boolean
If true, the cells in the control are editable (provided their columns are marked as editable) and the user can click on a cell and an editor will popup.
       focusedCell: Object
Creates the cellEditor on the specified cell.
       header_mc: MovieClip
The column headers are all children of this MovieClip.
       headerHeight: Number
Height of the header bar of the grid, in pixels.
       lines_mc: MovieClip
The layer on which to draw grid lines between columns.
       minColWidth: Number
Resizable columns are not shrunk below this number of pixels.
       resizableColumns: Boolean
If true, the user can stretch the columns of the DataGrid control by dragging the grid lines between the headers.
       selectable: Boolean
If true, the user can select DataGrid items.
       showHeaders: Boolean
If true, the DataGrid control shows column headers.
       sortableColumns: Boolean
If true, the user can sort the columns of the DataGrid control by clicking on the headers.
       sortArrow: MovieClip
Specifies the small arrow graphic used to show sortable columns and direction.
       stretchBar: MovieClip
Specifies a graphic that shows the proposed column width as the user stretches it.
       stretcher: MovieClip
Specifies the cursor used to show that you can stretch a column.
staticversion: String
Version string for this class.

Properties inherited from class mx.controls.List
version  

Properties inherited from class mx.controls.listclasses.ScrollSelectList
cellRenderer   dataProvider   dataTipField   dataTipFunction   dragEnabled   dropIndicatorSkin   iconField   iconFunction   labelField   labelFunction   multipleSelection   rowCount   rowHeight   rowRenderer   selectable   selectedIndex   selectedIndices   selectedItem   selectedItems   showDataTips   value   variableRowHeight   verticalAlign   wordWrap  

Properties inherited from class mx.core.ScrollView
className   hPosition   hScrollPolicy   liveScrolling   maxHPosition   maxVPosition   scrollTipFunction   showScrollTips   version   vPosition   vScrollPolicy  

Properties inherited from class mx.core.View
baselinePosition   className   numChildren   version  

Properties inherited from class mx.core.UIComponent
enabled   errorString   tabEnabled   tabIndex   version  

Properties inherited from class mx.core.UIObject
alpha   baselinePosition   className   depth   documentDescriptor   height   heightFlex   id   instanceIndices   isDocument   kStretch   layoutHeight   layoutWidth   maxHeight   maxWidth   minHeight   minWidth   mouseX   mouseY   nestLevel   oldHeight   oldWidth   oldX   oldY   parent   parentApplication   parentDocument   percentHeight   percentWidth   preferredHeight   preferredWidth   repeaterIndices   scaleX   scaleY   styleName   tabEnabled   toolTip   version   visible   width   widthFlex   x   y  



Effects

Effects inherited from class mx.core.UIComponent
focusInEffect   focusOutEffect  

Effects inherited from class mx.core.UIObject
creationCompleteEffect   hideEffect   mouseDownEffect   mouseOutEffect   mouseOverEffect   mouseUpEffect   moveEffect   resizeEffect   showEffect  



Events
cellEditBroadcast when a cell's value has been changed via a cell editor. Only broadcast if the cell/column is editable. The event object contains the properties:
- itemIndex Index of the selected item.
- columnIndex Index of the selected column.
- oldValue Previous value of the cell.
- target Reference to the component that triggered the event.
- type Name of the event.
cellFocusInBroadcast when a cell gets focus which can occur if the user clicks on a cell or navigates to the cell via keyboard. The event object contains the properties:
- itemIndex Index of the selected item.
- columnIndex Index of the selected column.
- target Reference to the component that triggered the event.
- type Name of the event.
cellFocusOutBroadcast when a cell loses focus which can occur if the user clicks on another cell, or outside the grid, or navigates to another cell or outside the grid via keyboard. The event object contains the properties:
- itemIndex Index of the selected item.
- columnIndex Index of the selected column.
- target Reference to the component that triggered the event.
- type Name of the event.
cellPressBroadcast when the user clicks on a cell to indicate that the cell is about to be edited. The event object contains the properties:
- itemIndex Index of the selected item.
- columnIndex Index of the selected column.
- view Currently selected Object.
- target Reference to the component that triggered the event.
- type Name of the event.
columnStretchBroadcast when a user stretches a column horizontally indicating that the amount of data displayed in that column has changed. If hScrollPolicy is none, other columns will shrink or stretch to compensate for the columns resizing and they will also broadcast this event. The event object contains the properties:
- columnIndex Index of the selected column.
- target Reference to the component that triggered the event.
- type Name of the event.
headerReleaseBroadcast when a column header is pressed and released, indicating that a sort operation is about to occur. Only broadcast if the column is sortable. The event object contains the properties:
- view Currently selected Object.
- columnIndex Index of the selected column.
- target Reference to the component that triggered the event.
- type Name of the event.

Events inherited from class: mx.controls.listclasses.ScrollSelectList
change  itemRollOut  itemRollOver 

Events inherited from class: mx.core.ScrollView
scroll 

Events inherited from class: mx.core.View
childCreated  childDestroyed  childIndexChanged 

Events inherited from class: mx.core.UIComponent
focusIn  focusOut  invalid  keyDown  keyUp  valid  valueCommitted 

Events inherited from class: mx.core.UIObject
creationComplete  dragComplete  dragDrop  dragEnter  dragExit  dragOver  draw  effectEnd  effectStart  hide  hideToolTip  initialize  load  mouseChangeSomewhere  mouseDown  mouseDownSomewhere  mouseMove  mouseMoveSomewhere  mouseOut  mouseOver  mouseUp  mouseUpSomewhere  move  resize  show  showToolTip  unload 



Styles
backgroundDisabledColor Type: Number   Format: Color   CSS Inheritance: yes
Background color of the grid when disabled. The default value is 0xEFEEEF.
hGridLineColor Type: Number   Format: Color   CSS Inheritance: yes
Color of the horizontal grid lines. The default value is 0x666666.
hGridLines Type: Boolean   CSS Inheritance: no
If true, shows horizontal grid lines. If false, hides horizontal grid lines. The default value is false.
headerColor Type: Number   Format: Color   CSS Inheritance: yes
Color of the column headers. Deprecated - use headerColors instead.
headerColors Type: Array   CSS Inheritance: yes
Array of two colors used to draw the header. The first color is the top color. The second color is the bottom color. The default values are (0xE6EEEE, 0xFFFFFF).
headerStyle Type: String   CSS Inheritance: no
CSS style declaration for the column header that you apply to a grid or column.
rollOverColor Type: Number   Format: Color   CSS Inheritance: yes
Color of the background when the user rolls over the link. The default value is 0xE3FFD6.
selectionColor Type: Number   Format: Color   CSS Inheritance: yes
Color of the background when the user selectes the link. The default value is 0xCDFFC1.
vGridLineColor Type: Number   Format: Color   CSS Inheritance: yes
Color of the vertical grid lines. The default value is 0x666666.
vGridLines Type: Boolean   CSS Inheritance: no
If true, shows vertical grid lines. If false, hides vertical grid lines. The default is false.

Styles inherited from class mx.controls.List
alternatingRowColors   marginBottom   marginTop   rollOverColor   selectionColor   selectionDisabledColor   selectionDuration   selectionEasing   textRollOverColor   textSelectedColor   useRollOver  

Styles inherited from class mx.core.UIComponent
backgroundAlpha   backgroundColor   backgroundDisabledColor   backgroundImage   backgroundSize   barColor   borderCapColor   borderColor   borderSides   borderStyle   borderThickness   cornerRadius   disabledColor   dropShadow   errorColor   fillColors   highlightColor   modalTransparency   scrollTrackColor   selectedFillColors   shadowCapColor   shadowColor   shadowDirection   shadowDistance   symbolBackgroundColor   symbolBackgroundDisabledColor   symbolBackgroundPressedColor   symbolColor   symbolDisabledColor   themeColor  

Styles inherited from class mx.core.UIObject
color   fontFamily   fontSize   fontStyle   fontWeight   horizontalGap   leading   marginLeft   marginRight   textAlign   textDecoration   textIndent   verticalGap  



Method Detail

addColumn

addColumn( newCol) :  mx.controls.gridclasses.DataGridColumn

Appends a column to the end of the DataGrid.

Parameters
    newCol - The string name of the new column, or a DataGridColumn.

Returns
     The new column.


addColumnAt

addColumnAt( index: Number, newCol) :  mx.controls.gridclasses.DataGridColumn

Adds a column at the specified index. An index of 0 makes the new column the leftmost column.

Parameters
    index: Number - The index for the new column.
    newCol - The string name of the new column, or a DataGridColumn.

Returns
     The new column.


draw

draw( )

Creates the headers, draws the rows and cells, then sizes and draws the column headers.


editField

editField( index: Number, colName: String, data) :  Void

Updates the value of a cell in a column with new data.

Parameters
    index: Number - Index of the item to edit.
    colName: String - Name of the field to edit.
    data - New data to put in the edited field.


getColumnAt

getColumnAt( index: Number) :  mx.controls.gridclasses.DataGridColumn

Returns a column at a specified location. Anindex of 0 returns the leftmost column.

Parameters
    index: Number - Index of the column to retrieve.

Returns
     Column at the specified index.


getColumnIndex

getColumnIndex( name: String) :  Number

Get the index of a specified column based on the column name. An index of 0 means it is the leftmost column.

Parameters
    name: String - Name of the column whose index you want.

Returns
     The column index.


getRowMetrics

getRowMetrics( ) :  Object

Same as the getViewMetrics() method, but factors in the headerHeight.

Returns
     Object containing left, top, right and bottom properties.


layoutChildren

layoutChildren( ) :  Void

Sizes and positions the column headers, columns, and cells based on the size of the DataGrid.


measure

measure( )

Measures the DataGrid based on its contents, summing the total of the visible column widths.


placeSortArrow

placeSortArrow( ) :  Void

Draw the sortArrow graphic on the column that is the current sortIndex.


removeAllColumns

removeAllColumns( ) :  Void

Removes all columns.


removeColumnAt

removeColumnAt( index: Number) :  mx.controls.gridclasses.DataGridColumn

Removes a column at the specified location. An index of 0 removes the leftmost column.

Parameters
    index: Number - Index of the column to remove.

Returns
     The removed column.



Property Detail

cellEditor

cellEditor: MovieClip  

A reference to the cell editor, if it exists.


columnCount

columnCount: Number   [Read-Only]

Number of columns that can be displayed. Some may be offscreen depending on hScrollPolicy and the width of the DataGrid.


columnNames

columnNames: Array  

An array of strings used to generate the column headers. All existing columns are destroyed.


columns

columns: Array  

An array of DataGridColumns, one for each visible column


editable

editable: Boolean  

If true, the cells in the control are editable (provided their columns are marked as editable) and the user can click on a cell and an editor will popup. The default value is false.


focusedCell

focusedCell: Object  

Creates the cellEditor on the specified cell. Scrolls the cell into view if necessary.


header_mc

header_mc: MovieClip  

The column headers are all children of this MovieClip.


headerHeight

headerHeight: Number  

Height of the header bar of the grid, in pixels. The default height is 20.


lines_mc

lines_mc: MovieClip  

The layer on which to draw grid lines between columns.


minColWidth

minColWidth: Number  

Resizable columns are not shrunk below this number of pixels. Do not set to zero or else columns disappear completely.


resizableColumns

resizableColumns: Boolean  

If true, the user can stretch the columns of the DataGrid control by dragging the grid lines between the headers. The value of this property must be true for individual columns to be resizable. The individual columns must also have their resizeable properties set to true. The default value is true.


selectable

selectable: Boolean  

If true, the user can select DataGrid items. The default value is true.


showHeaders

showHeaders: Boolean  

If true, the DataGrid control shows column headers. The default value is true.


sortableColumns

sortableColumns: Boolean  

If true, the user can sort the columns of the DataGrid control by clicking on the headers. This property must be set to true for individual columns to be sortable. The column must also be marked as sortable. This property must be true to receive the headerPress event. The default value is true.


sortArrow

sortArrow: MovieClip  

Specifies the small arrow graphic used to show sortable columns and direction.


stretchBar

stretchBar: MovieClip  

Specifies a graphic that shows the proposed column width as the user stretches it.


stretcher

stretcher: MovieClip  

Specifies the cursor used to show that you can stretch a column.


version

static  version: String  

Version string for this class.


Examples
SimpleDataGrid.mxml
<?xml version="1.0"?>
<!-- Simple example No:1 to demonstrate the DataGrid control -->
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" backgroundColor="#FFFFFF">

    <mx:Panel title="DataGrid Panel" marginTop="10" height="100%" width="100%">

        <mx:DataGrid editable="true" height="100%" width="100%">

            <mx:dataProvider>
                <mx:Array>

                    <mx:Object>
                        <Artist>Pavement</Artist>
                        <Price>9.99</Price>
                        <Album>Slanted and Enchanted</Album>
                    </mx:Object>

                    <mx:Object>
                        <Artist>Pavement</Artist>
                        <Price>9.99</Price>
                        <Album>Brighten The Corners</Album>
                    </mx:Object>

                </mx:Array>
            </mx:dataProvider>

        </mx:DataGrid>

    </mx:Panel>

</mx:Application>
        




DataGridExample.mxml
<?xml version="1.0"?>
<!-- Simple example No:2 to demonstrate the DataGrid control -->
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" backgroundColor="#FFFFFF">

    <mx:Script>
        <![CDATA[
         
          function cellPressEvt(event)
	  {
	       clean();
	       focusCol.text=focusCol.text +  '\n' + event.columnIndex;
	       focusItem.text=focusItem.text + '\n' + event.itemIndex;
	       focusType.text=focusType.text + '\n' + event.type;
	  }
	  
	  function clean()
	  {
	       focusCol.text="ColumnIndex";
	       focusItem.text="ItemIndex";
	       focusType.text="EventType";
	  }
	    
	    ]]>
    </mx:Script>

    <mx:Panel title="DataGrid Panel" marginTop="10">

        <mx:VBox>

            <mx:DataGrid id="myGrid" width="350" height="100" cellPress="cellPressEvt(event);">

                <mx:dataProvider>
                    <mx:Array id="arr">
                        <mx:Object Artist=" Kapil" Album="All Time Favourites" Price="10"/>
                        <mx:Object Artist=" Kapil" Album="Classic Songs" Price="10"/>
                    </mx:Array>
                </mx:dataProvider>

            </mx:DataGrid>

        </mx:VBox>

        <mx:HBox>

            <mx:TextArea id="focusCol" text="ColumnIndex"/>
            <mx:TextArea id="focusItem" text="ItemIndex"/>
            <mx:TextArea id="focusType" text="EventType"/>

        </mx:HBox>

    </mx:Panel>

</mx:Application>   
        




Comments


No screen name said on Jan 15, 2005 at 5:48 AM :
i have two DataGrid,they are all dragenabled.wher i drag a item to another,i wanna to copy the data into the target ,then delete the data from its source dataGrid.how can i do it ?
smgilson said on Jan 18, 2005 at 10:54 AM :
You can see an example just like you describe in the Flex Explorer example that ships with Flex, or on our website at: http://www.macromedia.com/devnet/flex/example_apps.html. Look for the 'Drag and Drop' example in the explorer window.

Stephen Gilson
Flex Doc
No screen name said on Jan 27, 2005 at 5:47 AM :
I have a datagrid,and I have a webservice which is a cfc file.
now i want pass all the items in the dataGrid to a method in the webservice,just like:
ws.insertData(datagrid.dataProvider);
but error occured. it seems I use the wrong data Type between the server side and the client side.
how can i do it ? is there some samples?
mpeterson said on Jan 27, 2005 at 10:51 AM :
Regarding the previous comment:

Thanks for your comment on Macromedia Flex LiveDocs. We use LiveDocs for gathering feedback on the documentation. This is a question best handled by our support team. You can contact them at:

http://www.macromedia.com/support/flex/

You can also contact the Flex development community using the Flex forums at:

http://www.macromedia.com/cfusion/webforums/forum/index.cfm?forumid=60

You also might want to join the Flex Coders mailing list at:
http://www.flexcoders.org

- Mike Peterson
Flex documentation team
No screen name said on Mar 9, 2005 at 8:14 AM :
The doc for the datagrid says:

The DataGrid control provides the following features:
...
Multiple modes of selection (row, column, cell, and edit), and selection events
...


My question is how do I select a column? When selectable=true, only rows are selectable. I don't see the property that allows me to say what the 'selection mode' is...

Thanks,
Cliff
smgilson said on Mar 15, 2005 at 8:54 AM :
There is currently no way to select the column of a DataGrid control.

Stephen Gilson
Flex Doc
01merced said on Mar 17, 2005 at 10:58 AM :
setting the headerColors style seems to hve no effect. Is there an error in the documentation? Thanks

Dustin Mercer
halL said on Mar 18, 2005 at 9:28 AM :
In Response to 01Merced:

There is a known issue, bug number 103620, with setting headerColors using the setStyle method, but you should be able to set it in the MXML tag.
The bug description is: "Setting headerColors via setStyle is not taking effect until any user interaction on DataGrid. Setting headerColors in DataGrid tag works correctly."
I confirmed that setting headerColors in the tag and it worked correctly, although on a developmental build.
dhirenb said on Apr 23, 2005 at 9:14 AM :
The description of the DataGrid control mentions that the DataGrid provides:
Optional customizable column and row headers

I don't see any way to set row headers and declare a scroll policy to have them static on horizontal scrolling. Is this possible?
No screen name said on May 22, 2005 at 7:24 PM :
How to delete all contents of dataDrid ? is there any possibility to remove all data from cells and rows without destroing rows ,headers etc.

there should be add a function passed to datagrid that clear all content

myGrid.clearData();

it should refresh datagrid component and returns it as before add any objects.
No screen name said on May 22, 2005 at 7:29 PM :
If there's a script that slect and set focus to next or previous cell , when i press button , like :
on(press){
myDataGrid.selectNextCell();
}

myDataGrid.selectPrevCell();

how to do such thing?

Thanxs
Duality.Enigma said on Jul 13, 2005 at 12:05 PM :
cellFocusIn event isn't broadcasting when the focus of the dataGrid is changed.

For instance cellPress="changeData(event)" calls the function properly when the data is clicked, however, cellFocusIn="changeData(event)" does NOT call the function when I change the row with the arrow keys or click on a row.

Is this a known bug?
No screen name said on Jul 18, 2005 at 8:47 AM :
the initial syntax description dont include columnnames and columncount properties whereas the property description has them
smgilson said on Jul 26, 2005 at 9:10 AM :
The columnNames property has a typo - it is called columnName in the MXML syntax. We will fix that in the next release.

columnCount is read only and therefore omitted from the MXML syntax since you cannot set it.

Stephen Gilson
mr_dan said on Sep 15, 2005 at 9:46 AM :
The DataGridColumn documentation page mentions that the datagrid has a sort method, "the DataGrid.sort() method." This is not mentioned on the datagrid documentation page.
mr_dan said on Sep 15, 2005 at 10:44 AM :
Rather, for programmatic sorting, use the datagrid's "sortItemsBy" method with the direction parameter being the either literal string "asc" or "desc"

function sortItemsBy (columnName:String, direction:String):Void;

Sample:
var dg:mx.controls.DataGrid = datagrid1;
dg.sortItemsBy("LastName","asc");

Since programmatic sorting (useful when the grid's dataProvider changes and you want to retain the sort order on the desired column) doesn't update the sort arrow, I wouldn't mind seeing also how this is done.
halL said on Sep 16, 2005 at 9:02 AM :
In response to the two comments from mr_dan on sorting.

You are correct, that there is no DtaGrid.sort() method.
It is correct that you can use the SortIemtsBy() method.
If you have fields that do not require a standard numeric or alphabetic sort, you can use the SortItems() method, which requires you to provide a comparison function.

We will consider enhancing the documentation for the next Flex release with DataGrid sorting examples.
aubweb said on Jan 9, 2007 at 12:23 AM :
In response of how to clear a datagrid,
I use : myDataGrid.dataProvider = null ;

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flex/15/asdocs_en/mx/controls/DataGrid.html