【问题标题】:Extjs 4.2 grid groupHeaderTpl IssueExtjs 4.2 网格 groupHeaderTpl 问题
【发布时间】:2015-05-22 11:29:34
【问题描述】:

如何获得 ExtJS 4.2 网格中 Group 的总数,该网格具有分组功能,也实现了分页。

组的计数不反映该组的总数,而是该组适合页面的数量。在上面的示例中,我有一个长度为数百条记录的分组。我的页面设置为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");
            }


        }

【问题讨论】:

    标签: c#-4.0 extjs4.2


    【解决方案1】:

    如果您正在查找每个组中的项目总数,那么您可以使用以下内容:

    groupHeaderTpl: ['{columnName}: {name} ({children.length}) ']
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多