User Guide

DataGrid.addColumnAt() 269
Example
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);
DataGrid.addColumnAt()
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
myDataGrid.addColumnAt(index, name)
myDataGrid.addColumnAt(index, dataGridColumn)
Parameters
index The index position at which the DataGridColumn object is added. The first
position is 0.
name A string that indicates the name of the DataGridColumn object.
dataGridColumn An instance of the DataGridColumn class.
Returns
A reference to the DataGridColumn object that was added, or returns the string that indicates
the name of the new column.