說我有一個店:ExtJS的:阿爾特商店的pageSize
Ext.define('MyApp.store.MyTestStore', {
extend: 'Ext.data.Store',
alias: 'store.MyTestStore',
requires: [
'MyApp.model.MyTestModel'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
autoSync: true,
model: 'MyApp.model.MyTestModel',
remoteFilter: true,
remoteSort: true,
storeId: 'MyTestStore',
buffered: true,
pageSize: 100,
listeners: {
load: {
fn: me.onStoreLoad,
scope: me
},
beforeload: {
fn: me.onStoreBeforeLoad,
scope: me
}
}
}, cfg)]);
},
onStoreLoad: function(store, records, successful, eOpts) {
console.log('load', records.length);
},
onStoreBeforeLoad: function(store, operation, eOpts) {
console.log('beforeload',operation);
}
});
如您最初看到我的pageSize加載:100這是完美的,當我最初加載這個商店,但後來我希望能夠加載所有它又名我想能夠改變pageSize。我嘗試了以下內容:
Ext.getStore('MyTestStore').reload({params:{start:0, limit:50000}});
Ext.getStore('MyTestStore').reload({start:0, limit:50000, page:1, addRecords:true});
但似乎都沒有工作。我想這是很明顯的引起了pageSize的仍設置爲100。於是我就和更新上飛店:
Ext.getStore('MyTestStore').lastPageSize = 50000;
Ext.getStore('MyTestStore').pageSize = 50000;
Ext.getStore('MyTestStore').pageMap.pageSize = 50000;
現在,當我CONSOLE.LOG(Ext.getStore(「MyTestStore」))顯示一切正確的,但我仍然只有100個記錄。我查看了從服務器返回的代碼,並且我正確地獲取了每條記錄,但是當函數'onload'超過記錄計數時保持爲100.是否有改變它並強制它改變它自己的pagesize?
編輯(附加信息):
所以另一個怪異的一部分是,當我做到以下幾點:在我的控制檯
load 100
6362 true
:
Ext.getStore('MyTestStore').reload({start:0, limit:50000, page:1, addRecords:true, callback : function(r, options, success) {
console.log(r.length,success)
}});
我回去。第一行來自'onStoreLoad'函數,第二行來自我的重載功能。很顯然,我收回了我的所有記錄,但其中大部分都被封鎖了。