PDA

View Full Version : Accessing Summary Value



Johny Joe
16 Jun 2010, 12:08 AM
Hi, I have a grouping Grid. And have a problem accessing the summary value of another field:
here's the picture (also my question) :
http://sphotos.ak.fbcdn.net/hphotos-ak-snc4/hs113.snc4/36009_1365355334205_1241289661_30994249_1410336_n.jpg

I use one of summary samples and here's the code:

var summary = new Ext.ux.grid.GroupSummary();

,columns: [
new Ext.grid.RowNumberer()
,{header: "Order", width: 50, sortable: true, dataIndex: 'order', align: 'right', summaryType: 'sum'}
,{header: "Index", width: 75, sortable: true, dataIndex: 'index', align: 'right', summaryType: 'sum'
,renderer: function(v, meta, rec, row, col, ds){
return v.toFixed(2);
}
}
]


Thanks.

Ant1105
16 Jun 2010, 3:05 PM
If you look at the methods inside of the GroupSummary, there is one called getSummaryNode. This will give you the bottom DOM portion that makes up the summaries. Then you could simply traverse the DOM to find the necessary column. Can try something like this...



// Get the summary node as an Ext.Element
var summaryNode = Ext.get(summary.getSummaryNode(grid.id));

// Change column number based on column you want
var yourColumn = summaryNode.select('div[class*="x-grid3-col-3"] > span', true).elements[0];
var yourValue = yourColumn.dom.innerHTML;

console.log(yourValue);

Johny Joe
16 Jun 2010, 3:20 PM
thanks!