ext6.2分頁給加額外引數用Ext.data.Store的extraParams
阿新 • • 發佈:2018-12-31
我們分頁時候經常會用到 根據上一個id值在進行分頁,預設的beforload不好用,可以這樣在store里加屬性值給Ext.data.Store新增額外的預設引數
Ext.define('Test.store.Contacts', {
extend: 'Ext.data.Store',
model: 'Test.model.Contact',
autoLoad: true,
pageSize: 35,
autoLoad: {start: 0, limit: 35},
proxy: {
type: 'ajax',
api: {
read : 'Test/view.action' ,
create : 'Test/create.action',
update: 'Test/update.action',
destroy: 'Test/delete.action'
},
extraParams: {
ddCode: 0
},
reader: {
type: 'json',
root: 'data',
successProperty: 'success'
},
writer: {
type: 'json',
writeAllFields: true,
encode: false,
root: 'data'
},
listeners: {
exception: function(proxy, response, operation){
Ext.MessageBox.show({
title: 'REMOTE EXCEPTION' ,
msg: operation.getError(),
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
}
}
}
});
//修改引數的值
Xxxx.getStore().getProxy().extraParames.ddCode = value;
Xxxx.getStore().load();