PDA

View Full Version : PagingToolbar problem with PagingMemory



hermann.s
13 Dec 2013, 5:54 AM
I have the following store :


Ext.define('MCS.store.case.Download', {
extend: 'Ext.data.Store',
requires: ['MCS.model.case.Download', 'Ext.ux.data.PagingMemoryProxy'],
model: 'MCS.model.case.Download',

autoLoad: false,

proxy:
{
type: 'pagingmemory',
},
pageSize: 2
});


The following service grabs the data and loads the store with it.


getDownloads: function (processInstanceID, portalID) {
Ext.Ajax.request({
url: Global.servicePath + '/Task/' + processInstanceID + '/download',
success: function (response) {
var jsonData = Ext.JSON.decode(response.responseText);

caseController = MCS.getApplication().controllers.items[1];

caseController.getCaseDownloadStore().setProxy({
type: 'pagingmemory',
data: jsonData
});
caseController.getCaseDownloadStore().load();
}
});
}


But why do I have to set the Proxy again with the data?

I tried using


caseController.getCaseDownloadStore().loadData(jsonData);

//instead of

caseController.getCaseDownloadStore().setProxy({
type: 'pagingmemory',
data: jsonData
});
caseController.getCaseDownloadStore().load();


but the pagingtoolbar did not display the number of pages and didn't work.

manilodisan
13 Dec 2013, 3:46 PM
I have the same issue. I'm adding data to the store via a loop. My data loads ok and is displayed in the grid but when I hit the grid's paging toolbar for a reload all my data from the grid disappears (store is empty when called again in the console).

If you place a console.log(this.data); on the PagingMemoryProxy inside the read method it will come back as undefined when you load the store (console or paging toolbar).

I don't know if we're missing something but I'm pulling my hair out for weeks. Right now I'm just not using paging toolbars since i'm still in development but it will be an issue soon.