View Full Version : Extjs 4.2 grid groupHeaderTpl Issue

27 May 2015, 10:22 PM
How can I get the total count of Group in ExtJS 4.2 grid with grouping feature which also has pagination implemented.
The counts for a Group do not reflect the total for that group but rather the number for that group that will fit on the page. In the above example I have a Grouping that is several hundred records in length. I have the page set for 50, so it shows 50. If I set the page for 10, it shows 10. If I set it for 20, it will show 20.
But, I would want the heading to show the total number for the group without regard to the pagination (records per page).
The code I have implemented for count is:

var groupingFeature = Ext.create('Ext.grid.feature.Grouping',
groupHeaderTpl: new Ext.XTemplate(
'{columnName}:{name}, [Total: {[this.countTotal(values.rows)]}]',
'', {
countTotal: function (records) {
var totalSum = 0;
totalSum = records.length;
return totalSum;
} } ),
onLayout: function () {
Ext.get(this.innerHd).setStyle("float", "none");
this.scroller.setStyle("overflow-x", "scroll");
} }

Gary Schlosberg
28 May 2015, 8:43 AM
No way to do this out of the box since a given page has no knowledge of the entire data set. I'm guessing you'd have to return the total number (for each group) in your data (similar to the page total) and use that.