PDA

View Full Version : EXTGrid store.filter does not work with infinite scrolling



manas.nanda
13 Oct 2012, 4:55 AM
Hi,
I am facing problem with external filter of a store. Filter is triggered from a search box. The store load is triggered from controller(autoload = false) which takes care of parameter setting. Infinite scrolling works fine(loads around 6000 records with page size 200). But when I am applying filter based on text entered on textbox, I am not getting filter result on entire result set. It appears like the filter result comes from a page size of 200 records based on current v-scroll bar position. Please help.

I have infinite scrolling enabled in a store with following store properties:

Ext.define('APP.store.myStore', {
extend: 'Ext.data.Store',
model: 'APP.model.myModel',
storeId:'referenceStore',
autoLoad:false,
autosync:true,
buffered: true,
remoteSort: true,
pageSize: 200,
trailingBufferZone:10000,
leadingBufferZone:10000,

.......
.......

proxy : {
type : 'ajax',
url : SERVICE_BASE_URL + '/abc/1/viewRows.view',
reader : {
type : 'serviceResult',
root :'listOfModels' ,
totalProperty : 'totalItems',
onError : showUnhandledError
}
},
setProxyParameters : function(levelIdParam, nodeIdParam, hierarchyTypeParam){
this.proxy.extraParams = { parm1 : parmVal , parm2 :parmVal};
}

..........
.........



store load call from controller:

referenceStore.prefetch({
start: 0,
limit: 200,
callback: function() {
/*referenceGridStore.guaranteeRange(0, 199); <I tried both load page and guranteeRange(0,199)>/*
referenceGridStore.loadPage(1);
}
});
.......................
.......................

Filter call:
/**
* Fires when user changes text in textfield, for filter operation on grid
*/
onFilterTextChangeParent : function(field, searchText) {
var referenceStore = this.getReferenceStore();
if (searchText) {
referenceStore.remoteFilter = false;
referenceStore.clearFilter(true);
referenceStore.filter(


function(object) {
var searchName = object.get('col1');
var searchId = object.get('col2');


return (searchName.toLowerCase().indexOf(searchText.toLowerCase()) != -1 || searchId.toLowerCase().indexOf(searchText.toLowerCase()) != -1);
});
} else {
referenceStore.clearFilter();
}
}

mitchellsimoens
15 Oct 2012, 1:02 PM
This is because the filter method will only filter the current data set so anything not currently in the active data set will be ignored. IMO server filtering is best to do filtering