User Guide

272 DataGrid component (Flash Professional only)
Example
This example creates one column with the heading “name”, populates the column from an
array, and then adds the name “Chase” in the first row. Notice that the “age value is ignored,
because only the name column has been defined. If you dont specify a column (remove the
addColumn line), DataGrid automatically creates the appropriate columns. 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;
// Add columns to grid and add data.
my_dg.addColumn("name");
var myDP_array:Array = new Array({name:"John", age:33}, {name:"Jose",
age:41});
my_dg.dataProvider = myDP_array;
var item_obj:Object = {name:"Chase", age:30};
my_dg.addItemAt(0, item_obj);
DataGrid.cellEdit
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
listenerObject = new Object();
listenerObject.cellEdit = function(eventObject){
// Insert your code here.
}
myDataGridInstance.addEventListener("cellEdit", listenerObject)
Description
Event; broadcast to all registered listeners when cell value changes.
Version 2 Macromedia Component Architecture components use a dispatcher/listener event
model. The DataGrid component dispatches a
cellEdit event when the value of a cell has
changed, and the event is handled by a function (also called a handler) that is attached to a
listener object (
listenerObject) that you create. You call the addEventListener() method
and pass it the name of the handler as a parameter.