PDA

View Full Version : store.loadPage(index, options) ignores callback option



gfrancis1@gmail.com
28 Sep 2012, 7:02 AM
Hi,
I'm trying to load my grid (with paging) to a specific page.
I tried:
Ext.getCmp('resource_grid').getStore().load({ params: { start: 250, page: 5 }, callback: function(){ alert('foo') } })
but this loaded the first page, not page 5, although the callback was executed.
then I tried:
Ext.getCmp('resource_grid').getStore().loadPage(5, { callback: function(){ alert('foo') } })
and although this did correctly load page 5, the callback was not executed.

Can someone please advise how to load the desired page and have the callback executed?
(ext version 4.0.2)

redraid
28 Sep 2012, 7:45 AM
In 4.0.2a loadPage method dont pass callback parameter to operation
ext-4.0.2a/src/data/Store.js:


1318 loadPage: function(page) {
1319 var me = this;
1320
1321 me.currentPage = page;
1322
1323 me.read({
1324 page: page,
1325 start: (page - 1) * me.pageSize,
1326 limit: me.pageSize,
1327 addRecords: !me.clearOnPageLoad
1328 });
1329 },

try this workaround:


var store = Ext.getCmp('resource_grid').getStore();
store.currentPage = 5;
store.load({
callback: function(){ alert('foo') }
});

jibieta
2 Oct 2013, 6:05 AM
Thanks