User Guide

DataGrid.hScrollPolicy 291
In the following example, you change the sort direction using a column. With a DataGrid
instance named
my_dg on the Stage, paste the following code in the first frame of the
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 property, you can tell whether the sort order is ascending or
descending. The
sortDirection property is a string, so it traces as either ASC or DESC.
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
"on", "off", or "auto". The default value is "off".
If
hScrollPolicy is set to "off", columns scale proportionally to accommodate the
finite width.
NOTE
This differs from the List component, which cannot have hScrollPolicy set to "auto".