【问题标题】:Extjs grid grouping summaryExtjs 网格分组总结
【发布时间】:2016-07-01 05:01:27
【问题描述】:

是否可以在不使用组的情况下添加摘要。

var store = Ext.create('Ext.data.Store', {
    model: 'Task',
    groupField: 'reportType',
    proxy: new Ext.data.HttpProxy({
        url: 'getdata.php',
        actionmethods: {read: 'POST'},
        reader: {type: 'json', root:'data'}
    }),
    autoLoad: true
});

var showSummary = true;
var grid = Ext.create('Ext.grid.Panel', {
    height: 450,
    frame: true,
    id: 'test',
    iconCls: 'icon-grid',
    renderTo: document.body,
    store: store,
    features: [{
        id: 'group',
        ftype: 'groupingsummary',
        groupHeaderTpl: '{name}',
        hideGroupedHeader: true,
        enableGroupingMenu: true
    }],
    columns: [{
        text: '',
        width: 120,
        tdCls: 'task',
        sortable: true,
        dataIndex: 'oppdesc',
        hideable: false,
        summaryType: 'count',
        summaryRenderer: function(value, summaryData, dataIndex) {
            return 'In-Period RR';
        }
    }, {
        header: 'W1',
        flex: 1,
        sortable: true,
        dataIndex: 'week1',
        renderer : Ext.util.Format.usMoney,
        summaryType: function(records){
            var counter= 1;
            var data1;
            var data2;

            Ext.Array.forEach(records, function (record){
                if(counter ==1){
                    data1 = record.data.week1;
                }
                else {
                    data2 = record.data.week1;
                }
                counter++;
            });

            var summary = (data2/data1) * 100;
            return summary;

        }]
});

当未设置存储中的 groupField 配置时,似乎不会出现列摘要。 未设置 store 中的 groupField 配置时,似乎不会出现列摘要。

谢谢!

【问题讨论】:

    标签: user-interface extjs grid summary


    【解决方案1】:

    ftype: 'groupingsummary' 更改为ftype: 'summary'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-27
      相关资源
      最近更新 更多