2014-04-09 49 views
0

我有我總結的結果的問題:摘要多頁

我有結果的複式頁,我想整列的總和,但在我的情況下,它給了每個列的總和頁...

由於我的英語很差,我想你根本不懂任何事情。所以,我想給你一個例子:

我有這樣的:

第1頁

總:2

第2頁

總數:5

但我想在每一頁總整列的這樣的:

頁面1

總:(5 + 2)

頁2

合計:(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 
     }) 
    }); 

誰能幫助我嗎? 感謝

回答

0

summaryType也可以是一個函數,參數都是無證但是源代碼給我:

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

根本不理會記錄導致它只是一個頁面的記錄,但與實體店你可以得到他們全部。

+0

我試過這個,但它沒有工作......它不能識別「each」:'summaryType:function(store,records,field){var sum,courant = 0; store.each(function(records){ courant = 0; sum = courant + records.get('quantite'); }); 歸還金額; },'。 – wonderwoman

+0

做一個console.log(存儲),看看它是否包含一個商店。 –

+0

它包含一個商店,但它不能識別「每個」作爲一個函數:/ – wonderwoman

0

要做到這一點從客戶端是不可能的,因爲總數只能計算可用的總和,所以我不得不從服務器發送這個信息作爲另一個字段。