In the following example, you change the sort direction using a column. With a DataGrid
instance named
my_dg
main timeline:
var my_dg:mx.controls.DataGrid;
my_dg.setSize(150, 100);
my_dg.spaceColumnsEqually();
var myListener:Object = new Object();
myListener.headerRelease = function(evt:Object) {
trace("column "+evt.columnIndex+" header was pressed");
trace("\t current sort order is: "+evt.target.sortDirection);
trace("");
};
my_dg.addEventListener("headerRelease", myListener);
my_dg.addColumn("a");
my_dg.addColumn("b");
my_dg.addItem({a:'one', b:1});
my_dg.addItem({a:'two', b:2});
By accessing the
sortDirection
descending. The
sortDirection
DataGrid.hScrollPolicy
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
myDataGrid.hScrollPolicy
Description
Property; specifies whether the data grid has a horizontal scroll bar. This property can have the
value
,
, or
"on"
"off"
If
is set to
hScrollPolicy
finite width.
This differs from the List component, which cannot have
on the Stage
paste the following code in the first frame of the
,
property, you can tell whether the sort order is ascending or
property is a string, so it traces as either
. The default value is
"auto"
, columns scale proportionally to accommodate the
"off"
.
"off"
hScrollPolicy
DataGrid.hScrollPolicy
or
.
ASC
DESC
set to
.
"auto"
291
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers