PDA

View Full Version : [UNKNOWN][3.??] Ext.grid.GridPanel loads data twice



prebenbo
7 Jan 2010, 11:21 AM
I'm loading json data using JsonReader into a grid panel. Somehow there is two requests to the server - one with the default start and limit options (0 and 25), and a second for my specified start and limit options (0 and 100). Well, the code actually works - but is a bit "annoying" to see the loading of data is done twice on the initial request.

The javacode as follows:



var grid = new Ext.grid.GridPanel({
plugins: [ { ptype: 'ux-grid-metagrid' }, ],
store: {
autoLoad: {params:{start: 0, limit: 100}},
autoDestroy: true,
remoteSort: true,
reader: new Ext.data.JsonReader(),
proxy : new Ext.data.HttpProxy({
method: 'GET',
url: "?factory=db&menu=channel&channel=" + channel + "&json=1"
})
},
border: false,
stripeRows: true
});

Condor
8 Jan 2010, 10:46 PM
The default page size is 20 and not 25, so the request with limit 25 must come from your own code!

prebenbo
11 Jan 2010, 3:13 AM
I don't find the number 25 in my code, so I find it a bit strange. I'll do some further testing, and present a more complete example if I still have problems.

prebenbo
11 Jan 2010, 11:11 AM
I believe MetaGrid.js is to blame (line 294 has a perPage: 25) . As this is an extension this is not a bug in ext core. I modified the MetaGrid.js file, and removed the autoLoad stuff in my code, and now the data loads once with the correct count. Not very elegant, so if somebody can post a new version of MetaGrid.js which fixes this it would be great. I have a short example to demonstrate the bug if someone want to look into it.