PDA

View Full Version : Pagination with Store.loadData of Local array of JSON objects



sczyzewicz
25 Oct 2013, 7:26 AM
I have a scenario in which an AJAX response may contain an array of JSON objects to populate a Grid panel.

Pagination is defined on the Grid:
dockedItems: [{
xtype: 'pagingtoolbar',
store: me.warningsStore, // same store GridPanel is using
dock: 'bottom',
displayInfo: true,
pageSize: 2
}]

Array of JSON objects loaded as such (I also tried loadData):
myGrid.store.loadRawData(arrayOfJsonObjs);

Our store is defined as such:
Ext.define('ces.store.Warnings', {
extend: 'Ext.data.Store',
model: 'ces.model.Warnings',
pageSize: 2,
remoteSort: false,

proxy: {
type: 'pagingmemory',
enablePaging: true,
reader: {
type: 'json'
}
}
});

The problem is this: data is populated into the grid, and our paging bar displays "Showing 2 of 20" - however, all 20 are actually displaying.

Any assistance would be appreciated - thanks in advance!

mitchellsimoens
28 Oct 2013, 12:45 PM
Pagination is all done on the server, you should only load the one page into the store.