PDA

View Full Version : Filter on load not working in remoteJsonStore



manish8616
26 Dec 2013, 9:49 AM
I am trying to filter data in the remote store after loading. Filtering is not working.

code is provided below :

remoteJsonStore = new Ext.data.GroupingStore({
id: 'ourRemoteStore',
url: resourceUrl,
autoLoad: true,
reader: mainReader,
sortInfo:{field: 'pageName', direction: "ASC"},
listeners :{
scope: this,
'load': function(store,records,options ){
console.log('inside load')
store.clearFilter();
remoteJsonStore.filterBy(function(record){return record.get('state')== 'UNMATCHED';});
console.log("isFiltered = "+store.isFiltered());
console.log("remoteJsonStore isFiltered = "+remoteJsonStore.isFiltered());
console.log(remoteJsonStore);
}
}

firefoxSafari
26 Dec 2013, 11:18 AM
It's hard to say for sure what the issue is without more details, an isolated test case, and version information.

I've used local filtering on remote stores in Ext 4.2.1 and it works fine. What version are you using?

One thing that jumps out to me is that you are using Ext.data.GroupingStore and asking this in the 4.x forums, but AFAIK this class existed in 2.x and 3.x and does not exist in 4.x. In 4.x the proper way to group is to use features. Taken from the examples:



Ext.create('Ext.grid.Panel', {
title: 'Employees',
store: Ext.data.StoreManager.lookup('employeeStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Seniority', dataIndex: 'seniority' }
],
features: [{ftype:'grouping'}],
width: 200,
height: 275,
renderTo: Ext.getBody()
});


Are you using 4.x with some sort of compat layer?

manish8616
26 Dec 2013, 12:07 PM
I am using 3.4.

Gary Schlosberg
29 Dec 2013, 1:35 PM
I've relocated this thread to the Ext 3.x: Help & Discussion forum.

slemmon
13 Jan 2014, 12:50 PM
To make sure we're on the same page can you post a data snippet of what the store would be consuming on load?