我想从响应标头设置总计 或者 手动添加总计到加载的数据
store: Ext.create('Ext.data.Store', {
pageSize: globals.settings.items_per_page,
fields: ['AccountNumber', 'Pan', 'OfflineFactId', 'TransactionJalaliDate', 'BranchDescription', 'GroupCode', 'GroupDescription'],
proxy: {
type: 'ajax',
url: newUrl.replace(/{accountId}/g, account.AccountNumber),
limitParam: 'pageSize',
pageParam: 'pageNumber',
reader: {
type: 'json',
rootProperty: 'result.generalResult',
totalProperty: 'result'
}
},
autoLoad: true
})
我尝试文档(分页工具栏,商店,网格,....) 但我找不到任何有用的东西
我终于找到答案了。 “beginprocessresponse”监听器!
store: Ext.create('Ext.data.Store', {
pageSize: globals.settings.items_per_page,
fields: ['AccountNumber', 'Pan', 'OfflineFactId', 'TransactionJalaliDate', 'BranchDescription', 'GroupCode', 'GroupDescription'],
proxy: {
type: 'ajax',
url: newUrl.replace(/{accountId}/g, account.AccountNumber),
limitParam: 'pageSize',
pageParam: 'pageNumber',
reader: {
type: 'json',
rootProperty: 'result.generalResult',
totalProperty: 'result.total'
},
listeners: {
beginprocessresponse: function (store, response, operation) {
var totalPages = JSON.parse( response.getAllResponseHeaders()['x-pagination'] ).TotalRecords;
response.responseJson.result.total = totalPages;
}
}
},
autoLoad: true,
})