我正在尝试使用分组列创建高级数据网格。问题是,我不知道ADG应该有多少列。每组列包含两列,但组的数量由选择框设置。
此方法创建列(通过一些称为类选择的数据):
public function createAdvancesDataGrid():void
{
var adg:AdvancedDataGrid = this.currentStateADG;
var columns:ArrayCollection = new ArrayCollection();
for each (var currentClass:ClassAssetMetaData in columnsClasses)
{
var columnGroup:AdvancedDataGridColumnGroup = new AdvancedDataGridColumnGroup();
columnGroup.headerText = assetsLabelFunction(currentClass);
columnGroup.childrenDragEnabled = false;
columnGroup.sortable = false;
columnGroup.draggable = false;
columnGroup.editable = false;
var portionColumn:AdvancedDataGridColumn = new AdvancedDataGridColumn();
portionColumn.headerText="portion";
portionColumn.dataField = "portion"
portionColumn.width=80;
var marketValueColumn:AdvancedDataGridColumn = new AdvancedDataGridColumn();
marketValueColumn.headerText="marketValue";
marketValueColumn.dataField = "marketValue"
marketValueColumn.width=80;
columnGroup.children = [portionColumn, marketValueColumn];
columns.addItem(columnGroup);
}
adg.groupedColumns = columns.toArray();
adg.validateNow();
}
我的数据提供者是
的数组集合public class AssetMarketValue
{
public var portion:Number;
public var marketValue:Number;
public var order:int;
public var asset:BaseAssetMetaData;}
我希望数据网格使用来自数据提供者的AsssetMarketValue显示每个分组列,但不知何故,数据网格显示行中所有分组列的相同marketValue。
经过一番研究,我发现该组也应该有一个dataField,但由于我是通过actionscript动态生成列的,所以我不知道数据字段的名称。