PDA

View Full Version : buffered store loads all pages



innomative
30 Jul 2013, 12:44 PM
hello,

i have a infinite-scrolling-grid with a buffered store. if i call "grid.store.load()" it loads the first page and afterwards it automatically loads all other pages.
(e.g. i have about 1000 rows in my database. i call "store.load()", it loads the rows 0-200. afterwards it loads 200-400, 400-600,600-800 and 800-1000 simultaneously).

i think this is a bug, because i did not find anything to disable this "load-all"-function.

this is my grid:

Ext.widget({
xtype: "gridpanel",

border:false,
region: 'center',
id:'mygrid',

enableLocking: true,
store: "mystore",
multiSelect: true,
columns: ...,


});

this is my store:

Ext.create('Ext.data.Store', {
id:"mystore",
pageSize: 200,
model: 'mymodel',
remoteSort: true,
loadAllowed:false,
autoLoad:false,
buffered: true,
proxy: {
type: 'ajax',
url: 'store.php',
extraParams: {pgm:"bla"},
actionMethods: {
read: 'POST'
},
reader: {
root: 'data',
rawData:true,
totalProperty: 'count'
}
},
listeners:{
prefetch:function(){
Ext.getCmp('rowcounter').setText(this.totalCount);
},
beforeload:function(){
return this.loadAllowed; //this is for disabling autoLoad (im setting store.loadAllowed to true before i call store.load();
}
},
sorters: []
});

i have a second problem, but i think this is related to the first problem:
if i click on a column to resort it remotely, the store loads the first page, then firebug displays:

TypeError: records is undefined
if (records.length < 1) {
ext-all-debug.js (Line 93124)
then all other pages are loaded again, but nothing is displayed in the grid.

can somebody help me?

regards

innomative
31 Jul 2013, 3:09 AM
i have forgotten to mension that i use extjs 4.2.1

regards

alonweiss
2 Jun 2015, 11:36 PM
I've had a similar issue, and I've traced it to an improper use from my end -- the grid had 0 columns (I am dynamically creating the columns, and due to a bug 0 columns have been created).

Here's my guess: There is a logic where the returned dataset is converted into records, and an empty record (after converting it to a record/model) is skipped. The pre-fetch logic loads as many pages as necessary until the prefetch buffer is filled, which never happens.