Dec 24, 2011, 9:19 AM
Sum values in grid
Hi all
filter works OK, and now I need to LOOP through filtered grid records and add it to some variable.
I have found some example for exporting:
how can I get sum of some columns in grid (for example Float1 and Float2 columns)?
For example:
Float1
2.00
1.00
at the end, I need to have
Float1= 3.00
What is the code for adding values into single variable?
I know (from above example) that records.length is number of records in the grid, but don't know what is the name of each grid column variable?
Thanks
filter works OK, and now I need to LOOP through filtered grid records and add it to some variable.
I have found some example for exporting:
var exportData = function (format) {
FormatType.setValue(format);
var store = GridPanel1.store;
store.directEventConfig.isUpload = true;
var records = store.reader.readRecords(store.proxy.data).records,
values = [];
for (i = 0; i < records.length; i++) {
var obj = {}, dataR;
if (store.reader.meta.id) {
obj[store.reader.meta.id] = records[i].id;
}
dataR = Ext.apply(obj, records[i].data);
if (!Ext.isEmptyObj(dataR)) {
values.push(dataR);
}
}
store.submitData(values);
store.directEventConfig.isUpload = false;
};
complette code goes through grid and export it to Excel.how can I get sum of some columns in grid (for example Float1 and Float2 columns)?
For example:
Float1
2.00
1.00
at the end, I need to have
Float1= 3.00
What is the code for adding values into single variable?
I know (from above example) that records.length is number of records in the grid, but don't know what is the name of each grid column variable?
Thanks