betasec
Hi ,
i need to calculate the sum of some cells
to do that i use the code
var itemsArray = stocksGrid.extractItemList();
var sumCell = new Number(0);
for (var i in itemsArray) {
var c = stocksGrid.getValue(itemsArray,"o_Bid");
if (c==null) c=0;
var val = new Number(c).toFixed(4);
sumCell += Number(val);
}
for the cells that are feed data from server works fine
the problem is when i have cells with custom-data
like
var calc1 = A*B;
info.setCellValue("#Cell01",calc1.toFixed(4));
var itemsArray = stocksGrid.extractItemList();
var sumCell = new Number(0);
for (var i in itemsArray) {
var c = stocksGrid.getValue(itemsArray,"#Cell01");
if (c==null) c=0;
var val = new Number(c).toFixed(4);
sumCell += Number(val);
}
Thanks
Giuseppe Corti
Hi betasec,
Note that setCellValue does not update the internal model of the AbstractGrid so that if a value is set through this method it can't be used for features working on such model.
Please replace setCellValue statement with UpdateRow; e.g.:
[SYNTAX=JS]var calc1 = A*B;
stocksGrid.updateRow(key, {"#Cell01":calc1.toFixed(4)});[/SYNTAX]
betasec
Hi
this works fine
Thanks