PDA

View Full Version : Grid Summary calculated value for column



kurasp
22 Feb 2013, 2:53 PM
Is there a way to get the record or more specifically the column, for a Ext.grid.feature.Summary?

Pawel

scottmartin
22 Feb 2013, 4:57 PM
See if this helps:
http://jsfiddle.net/RMfzF/1/

If not, please provide a little more detail.

Scott.

kurasp
25 Feb 2013, 10:53 AM
Thanks for the quick reply Scott,

In the jsfiddle code you linked, is there a way to access the last row with values 600, 300 and 900?

Pawel

scottmartin
25 Feb 2013, 5:59 PM
Add a load listener to your store:



listeners : {
load : function(store, records){
console.log(records);
}
}

kurasp
26 Feb 2013, 12:19 PM
records will return all rows(3) except the summary row (last row).

In other words it would return an array containing:
[{Month1: 100, Month2: 50, total: 150}, {Month1: 200, Month2: 100, total: 300 },{Month1: 300, Month2: 150, total: 450}]

I would like to get the summary row.

Ideally, I would like to get it directly from the grid(Ext.grid.panel), and not a load event, but I can't seem to find how to access it from the grid.

kurasp
5 Mar 2013, 7:55 AM
Anybody have any ideas? or do I have to just recalculate the totals manually?

kurasp
9 May 2013, 7:44 AM
I was unable to get access to the summary row, so:
1) I created a separate grid for just the summary row
2) added listeners to the main grid panel that would calculate the sums and update the summary grid.


This actually worked out well, because the client wanted the summary row to not scroll with the rest of the grid, which occurs with Ext.grid.feature.Summary

sblommers
12 Jul 2013, 8:13 AM
The calculations are incorrect in 4.2.x

Remove 1 summary from a column and see the difference when switching between 4.1.1 and 4.2.x in jsFiddle.

Like this example: http://jsfiddle.net/yWKGg/