使用组件 |
|
|
|
| 使用组件创建应用程序(仅限 Flash Professional) > 绑定数据组件以显示礼品方案 > 将列添加到 Gift Ideas 部分 | |||
现在您已准备就绪,可以向应用程序的 Gift Ideas 部分的数据网格中添加列,以显示产品信息和价格。
// 定义数据网格列及其在 products_dg DataGrid 实例
// 中的默认宽度。
var name_dgc:DataGridColumn = new DataGridColumn("name");
name_dgc.headerText = "Name";
name_dgc.width = 280;
// 将列添加到 DataGrid。
products_dg.addColumn(name_dgc);
var price_dgc:DataGridColumn = new DataGridColumn("price");
price_dgc.headerText = "Price";
price_dgc.width = 100;
// 定义在运行时用来设置列标签
// 的函数。
price_dgc.labelFunction = function(item:Object) {
if (item != undefined) {
return "$"+item.price+" "+item.priceQualifier;
}
};
products_dg.addColumn(price_dgc);
|
|
|
|