如何在具有分组功能的ExtJS 4.2网格中获得分组总数,该功能也实现了分页。
组的计数不反映该组的总数,而是反映适合页面的该组的数量。在上面的示例中,我有一个长度为数百条记录的分组。我将页面设置为50,因此显示为50。如果我将页面设置为10,它将显示10。如果我将其设置为20,它将显示20。
但是,我希望标题显示组的总数,而不考虑分页(每页记录)。
我为count实现的代码是:
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");
}
}发布于 2016-01-21 05:15:53
如果您要查找每个组中的项目总数,则可以使用以下方法:
groupHeaderTpl: ['{columnName}: {name} ({children.length}) ']https://stackoverflow.com/questions/30395554
复制相似问题