我有一个数据报,它有列,列中有一个numericstepper作为项编辑器,用户可以在其中更改想要购买的项的数量。当用户更新数据报的值时,如何计算所有单元格的总和?
编辑1
我的数据报是关于产品的颜色和大小的。列是从该函数动态生成的
private function getColumn(dataField:String, headerText:String,editable:Boolean) : DataGridColumn
{
var column:DataGridColumn = new DataGridColumn(dataField);
column.headerText = headerText;
column.width = 20;
editable ? column.editable = true : column.editable = false;
column.editorDataField = "value";
column.itemEditor = new ClassFactory(ColorSizesFormRenderer);
return column;
}
然后循环我的XML HTTP结果
for each (var thisSize:XML in result.product.(@id == pId)..size) {
_columns.push(getColumn("size"+thisSize,thisSize,true));
}
那么我怎样才能找到所有单元格的和呢?
编辑2
我用这段代码循环我的所有单元格
protected function color_sizes_itemFocusOutHandler(event:DataGridEvent):void
{
total = 0;
for each(var row:Object in color_sizes.dataProvider) {
total += row.size28;
}
}
row.size28是动态生成的。所以可以是row.size29、row.size30等。
如何在不知道数据属性的情况下循环访问所有单元格?
提前谢谢