PDA

View Full Version : How do I access the cell values in the summary row?



borg
6 Sep 2013, 5:49 AM
Is there a way to access the record for the summary row?

ettavolt
6 Sep 2013, 6:12 AM
No, there is no.
You can specify 'summaryRenderer' and 'summaryType' functions for columns

borg
6 Sep 2013, 6:21 AM
Is my ONLY option to place the value into a global variable inside the summaryRenderer? There's GOT to be a way to access the cell's value remotely.

ettavolt
6 Sep 2013, 6:37 AM
The only way except caching the value - to recalculate it using Store.sum() or other aggregate method.

borg
6 Sep 2013, 7:12 AM
UPDATE: FIXED BY ADDING parseFloat() to return value in convert

There seems to be a conflict with summaryRenderer and the convert function. The summary value cannot be shown because for some reason convert returns the string concatenation of the number values rather than adding the numbers together.

So if I have these data values: [14816.38, 740.15, 2240.67]
This will be returned: 014816.38740.152240.67
Instead of: 17797.20

Here is my model's field:



fields: [{
name: 'price',
type: 'float',
convert: function(value, record) {
console.log('value: ' + value);
return parseFloat(value); // adding parseFloat() fixed it
// this is what I'd like to put here once this bug is fixed:
// return Ext.getStore('mystore').sum('price');
}
}]


Here is my grid's summaryRenderer



summaryRenderer: function(value, summaryData, dataIndex) {
console.log(value + ' ');
return Ext.util.Format.usMoney(value);
}