ActionScript 2.0 Components Language Reference |
|
|
|
| DataGrid component > DataGrid.getColumnIndex() | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
myDataGrid.getColumnIndex(columnName)
columnName A string that is the name of a column.
A number that specifies the index of the column.
Method; returns the index of the column specified by the columnName parameter.
The following example displays the index number of the "score" column. With a DataGrid instance named my_dg on the Stage, paste the following code in the first frame of the main timeline:
my_dg.setSize(150, 100);
// Set up sample data.
var myDP_array:Array = new Array();
myDP_array.push({name:"Clark", score:3135});
myDP_array.push({name:"Bruce", score:403});
myDP_array.push({name:"Peter", score:25});
my_dg.dataProvider = myDP_array;
var column_num:Number = my_dg.getColumnIndex("score");
trace("Column that has name of 'score': " + column_num);
|
|
|
|