I have this datagrid which has columns with a NumericStepper as an itemEditor where the user can change the number of items he wants to buy. How can I calculate the sum of all cells when the user updates datagrid's values?
EDIT 1
My datagrid is about colors and sizes of a product. The columns are generated dynamically from this function
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;
}
and then I loop my xml http result
for each (var thisSize:XML in result.product.(@id == pId)..size) {
_columns.push(getColumn("size"+thisSize,thisSize,true));
}
So how can I find the sum of all cells?
EDIT 2
I use this code to loop all my cells
protected function color_sizes_itemFocusOutHandler(event:DataGridEvent):void
{
total = 0;
for each(var row:Object in color_sizes.dataProvider) {
total += row.size28;
}
}
the row.size28 is generated dynamically. So it could be row.size29,row.size30 etc.
How can I loop through all my cells without knowing their data.property?
Thanks in advance