DataGrid.focusedCell

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX Professional 2004.

Usage

myDataGrid.focusedCell

Description

Property; in editable mode only, an object instance that defines the cell that has focus. The object must have the fields columnIndex and itemIndex, which are both integers that indicate the index of the column and item of the cell. The origin is (0,0). The default value is undefined.

Example

The following example sets the focused cell to the second column, eleventh row (numbered "10" because the first row is "0"). Because you can't access the cells until the DataGrid has finished drawing, use UIObject.doLater() to delay using the focusedCell property:

// Create a data provider with three columns and 50 rows.
var myDP:Array = new Array();
for (var i=0; i<50; i++)
  myDP.addItem({id:i, name:"Dave", price:"Priceless"});

// Assign the data provider to the DataGrid instance and set it to be editable.
my_dg.dataProvider = myDP;
my_dg.editable = true;

// Use UIObject.doLater() in the current timeline to call the function after the data grid has set all of its properties.
my_dg.doLater(this, "select");

function select() {
 my_dg.focusedCell = {columnIndex:1, itemIndex:10};
}