User Guide
DataGrid.editField() 285
DataGrid.editField()
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
myDataGrid.editField(index, colName, data)
Parameters
index The index of the target cell. This number is zero-based.
colName A string indicating the name of the column (field) that contains the target cell.
data The value to be stored in the target cell. This parameter can be of any data type.
Returns
The data that was in the cell.
Description
Method; replaces the cell data at the specified location and refreshes the data grid with the
new value. Any cell present for that value has its
setValue() method triggered.
Example
The following example places a value in the grid in the first row of the first column (index
value
0) when the button is clicked. With a DataGrid instance named my_dg nd a Button
instance named
my_btn on the Stage, paste the following code in the first frame of the main
timeline:
my_dg.setSize(140, 100);
// Set up sample data.
my_dg.dataProvider = [{name:"Clark", score:3135}, {name:"Bruce",
score:403}, {name:"Peter", score:25}];
// Create listener object.
var btnListener:Object = new Object();
btnListener.click = function() {
//Replace first field with new values.
my_dg.editField(0, "name", "Arthur");
};
// Add button listener.
my_btn.addEventListener("click", btnListener);