Flash 8 Documentation |
|||
| Components Language Reference > DataGrid component (Flash Professional only) > DataGridColumn class (Flash Professional only) | |||
ActionScript Class Name mx.controls.gridclasses.DataGridColumn
You can create and configure DataGridColumn objects to use as columns of a data grid. Many of the methods of the DataGrid class are dedicated to managing DataGridColumn objects. DataGridColumn objects are stored in an zero-based array in the data grid; 0 is the leftmost column. After columns have been added or created, you can access them by calling DataGrid.getColumnAt(index).
There are three ways to add or create columns in a grid. If you want to configure your columns, it is best to use either the second or third way before you add data to a data grid so you don't have to create columns twice.
for..in loop. For example, for a DataGrid instance named my_dg:
my_dg.dataProvider = [{guitar:"Flying V", name:"maggot"}, {guitar:"SG", name:"dreschie"}, {guitar:"jagstang", name:"vitapup"}];
DataGrid.columnNames to create the field names of the desired item fields and generate DataGridColumn objects, in order, for each field listed. This approach lets you select and order columns quickly with a minimal amount of configuration. This approach removes any previous column information. For example, for a DataGrid instance named my_dg:my_dg.columnNames = ["guitar","name"];
DataGrid.addColumn(). This approach is useful, and the most flexible, because it lets you add columns with proper sizing and formatting before the columns ever reach the grid (which reduces processor demand). For more information, see Constructor for the DataGridColumn class. For example, for a DataGrid instance named my_dg:
// Create column object.
var location_dgc:DataGridColumn = new DataGridColumn("Location");
location_dgc.width = 100;
// Add column to DataGrid.
my_dg.addColumn(location_dgc);
The following table lists the properties of the DataGridColumn class.
|
Property |
Description |
|---|---|
|
The linkage identifier of a symbol to be used to display the cells in this column. |
|
|
Read-only; the name of the field associated with the column. |
|
|
A Boolean value that indicates whether a column is editable ( |
|
|
The name of a class to be used to display the header of this column. |
|
|
The text for the header of this column. |
|
|
A function that determines which field of an item to display. |
|
|
A Boolean value that indicates whether a column is resizable ( |
|
|
A Boolean value that indicates whether a column is sortable ( |
|
|
A Boolean value that indicates whether a column is sorted ( |
|
|
The width of a column, in pixels. |
Version 8
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00003290.html