DataGrid.addItem()

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX Professional 2004.

Usage

myDataGrid.addItem(item)

Parameters

item An instance of an object to be added to the grid.

Returns

A reference to the instance that was added.

Description

Method; adds an item to the end of the grid (after the last item index).

NOTE

This differs from the List.addItem() method in that an object is passed rather than a string.

Example

This example creates one column with the heading "name" and then inserts the item_obj value for "name". Notice that the "age" value is ignored, because only the name column has been defined. If you don't 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:

// Add columns to grid and add data.
my_dg.addColumn("name");

var item_obj:Object = {name:"Jim", age:30};
my_dg.addItem(item_obj);