Using ActionScript 2.0 Components |
|
|
|
| Creating an Application with Components > Bind data components to display gift ideas > Add columns to the Gift Ideas section | |||
Now you are ready to add columns to the data grid in the Gift Ideas section of the application, for displaying product information and price.
// Define data grid columns and their default widths in the products_dg
// DataGrid instance.
var name_dgc:DataGridColumn = new DataGridColumn("name");
name_dgc.headerText = "Name";
name_dgc.width = 280;
// Add the column to the DataGrid.
products_dg.addColumn(name_dgc);
var price_dgc:DataGridColumn = new DataGridColumn("price");
price_dgc.headerText = "Price";
price_dgc.width = 100;
// Define the function that will be used to set the column's label
// at runtime.
price_dgc.labelFunction = function(item:Object) {
if (item != undefined) {
return "$"+item.price+" "+item.priceQualifier;
}
};
products_dg.addColumn(price_dgc);
|
|
|
|