【问题标题】:Summary for multiple page多页摘要
【发布时间】:2014-04-09 15:51:28
【问题描述】:

我的摘要结果有问题:

我有多页结果,我想要整个列的总和,但在我的情况下,它给出了每页列的总和......

由于我的英语很差,我想你什么都不懂,哈哈。所以我给你举个例子:

我有这个:

第 1 页

总数:2

第 2 页

总数:5

但我希望每个页面中整个列的总数如下:

第 1 页

总数:7 (5+2)

第 2 页

总数:7 (5+2)

这是我的代码:

    Ext.applyIf(me, {
        forceFit: true,
        loadMask: false,
        features: [{
            ftype: 'summary',
            dock: 'bottom'
        }],
        columns: [
            {
                header: ressources.HeaderTypeStockText,
                dataIndex: 'libelleTypeStock',
                summaryRenderer: function(){
                    return '<b> Total <b>';
                },
                flex: 0.1
            },
            {
                header: ressources.HeaderQuantiteText,
                dataIndex: 'quantite',
                summaryType: 'sum',
                flex: 0.1
            },
            {
                header: ressources.HeaderPoidsText,
                dataIndex: 'poids',
                summaryType: 'sum',
                flex: 0.1
            }

        ],
        store: storeGrid,
        // paging bottom bar
        bbar: Ext.create('Ext.PagingToolbar', {
            store: storeGrid,
            displayInfo: true,
            displayMsg: ressources.GridDisplayMsg,
            emptyMsg: ressources.GridEmptyMsg
        })
    });

谁能帮帮我? 谢谢

【问题讨论】:

    标签: extjs4 summary


    【解决方案1】:

    summaryType 也可以是一个函数,参数没有记录,但源代码给了我这个:

    summaryType: function(store, [records, field]) {
        store.each( **makesum** )
        return sum;
    }
    

    简单地忽略记录,因为它只是一个页面的记录,但是通过商店你可以得到它们。

    【讨论】:

    • 我试过了,但它不起作用......它无法识别“每个”:summaryType: function (store,records,field) {var sum,courant = 0; store.each(function (records) { courant = 0; sum = courant + records.get('quantite'); }); return sum; },.
    • 制作一个console.log(store)并查看它是否包含一个商店。
    • 它包含一个商店,但它不将“每个”识别为一个函数:/
    • 但它具有所有其他存储功能(store.prototype)?您可以手动迭代 store.data.items ...
    【解决方案2】:

    从客户端执行此操作最终是不可能的,因为总数只能汇总可用的内容,因此我不得不从服务器将此信息作为另一个字段发送。

    【讨论】:

      猜你喜欢
      • 2016-02-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-02
      • 1970-01-01
      相关资源
      最近更新 更多