I have a ext js grid with pagination and filtering on browser side. for example if there are 3 pages and i apply the filter to display last page records. Then it shows first and 2nd page blank and the filtered data is displayed on the last page. I have copied the code below for your reference. Can you please suggest what is wrong here?
<script>
Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('Ext.ux', '/extjs4/ux');
Ext.require([
'Ext.ux.grid.FiltersFeature'
]);
Ext.Loader.setConfig({enabled: true});
Ext.onReady(function() {
Ext.QuickTips.init();
Ext.tip.QuickTipManager.init();
var data2='jsonData from Server';
var mod2= Ext.define('Model', {
extend: 'Ext.data.Model',
fields: [
{name:'ID',mapping:'ID'} ,
{name:'Creation Date/Time',mapping:'Creation Date/Time'} ,
{name:'Unit',mapping:'Unit'}
]
});
var storeMain2 = Ext.create('Ext.data.Store', {
model: mod2,
autoLoad: false,
buffered: false,
pageSize: 10,
data: Ext.decode(data2),
proxy: {
type: 'pagingmemory',
reader: {
type: 'json',
root: 'user'
//totalProperty: 'totalCount'
}
},
remoteSort:true,
remoteFilter:true,
remoteGroup:true
});
var filters = {
ftype: 'filters',
autoReload: false,
encode: true,
local: true
};
// grid with pagination
var grid2 = Ext.create('Ext.grid.Panel', {
stateful: true,
multiSelect: true,
enableColumnMove:false,
store: storeMain2,
stateId: 'stateGrid',
autoHeight: true,
autoWidth: true,
title: ' ',
columnLines: true,
renderTo: Ext.getBody(),
features: [filters],
filterable: true,
columns: [
{
text : 'ID',
sortable : true,
align:'center',
width: 70,
dataIndex: 'ID',
filter: { type: 'numeric'}
}, {
text : 'Creation Date/Time',
width: 150,
sortable : true,
align:'center',
dataIndex: 'Creation Date/Time'
}, {
text : 'Unit',
width: 150,
sortable : true,
align:'center',
dataIndex: 'Unit'
}
],
listeners: {
'afterrender':function(e){
var gridthWidth = this.getWidth();
this.setWidth(gridthWidth);
this.setAutoScroll(true);
},
'columnresize': function(e){
var gridthWidth = this.getWidth();
this.setWidth(gridthWidth);
this.setAutoScroll(true);
} ,
render: function(e) {
this.store.on('load',function(){
});
}
},
bbar: Ext.create('Ext.PagingToolbar', {
store: storeMain2,
displayInfo: true,
emptyMsg: ""
})
} );
});
</script>