Using ExtJS 4.2 - I have an AJAX call populating the store with the entire set of results in JSON format (using loadRawData). I now need to limit the number of results being shown on the grid at a time. End goal is to implement client-side paging. I've tried using pagingmemoryproxy with not much luck.
Ext.define('TestApp.view.TestGrid' , {
extend: 'Ext.grid.Panel',
alias: 'widget.testgrid',
requires:[
'TestApp.store.TestStore'
],
initComponent: function() {
var me = this;
this.store = Ext.create('Ext.data.Store', {
model: 'TestApp.model.TestModel',
proxy: {
type: 'memory',
reader: {
type: 'json'
},
},
pageSize: 20
});
// set the maxRows parameter based on the store's page size
this.maxRows = this.store.pageSize;
this.columns = this.buildColumns();
this.bbar = Ext.create('Ext.PagingToolbar', {
itemId: 'pagingToolbar',
store: this.store,
dock: 'bottom',
displayInfo: true
});
this.callParent();
}
My controller uses the following AJAX call
Ext.Ajax.request({
url: '/testing/test',
method: "POST",
jsonData : requestParams,
timeout: 120000,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
success: function(response) {
var resp = Ext.decode(response.responseText);
var testStore = testGrid.getStore();
var numResults = response.getAllResponseHeaders().resultlength;
// this successfully loads results into store and populates grid
// with pagingtoolbar displaying page 0 of 0
testStore.loadRawData(resp);
//testStore.loadPage(1);
},