ActionScript 2.0 Components Language Reference |
|
|
|
| DataGrid component > DataGrid.addColumn() | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
myDataGrid.addColumn(dataGridColumn)myDataGrid.addColumn(name)
dataGridColumn An instance of the DataGridColumn class.
name A string that indicates the name of a new DataGridColumn object to be inserted.
A reference to the DataGridColumn object that was added, or returns the string that indicates the name of the new column.
Method; adds a new column to the end of the data grid. For more information, see DataGridColumn class.
This example shows three different ways of creating columns for a DataGrid component. With a DataGrid instance named my_dg on the Stage, paste the following code in the first frame of the main timeline (notice that it imports the DataGridColumn class first):
import mx.controls.gridclasses.DataGridColumn;
var my_dg:mx.controls.DataGrid;
my_dg.setSize(320, 240);
// Add columns to grid.
my_dg.addColumn("Red");
// Add another column to grid.
my_dg.addColumn(new DataGridColumn("Green"));
// Add a third column to grid.
var blue_dgc:DataGridColumn = new DataGridColumn("Blue");
blue_dgc.width = 140;
blue_dgc.headerText = "Blue Column:";
my_dg.addColumn(blue_dgc);
|
|
|
|