PDA

View Full Version : filtering store issue



ashish01
31 Dec 2010, 12:20 PM
Hi all,

Not sure if I am missing something obvious but spent a lot of time researching an issue and finally found a solution. I am using an AjaxProxy to load a JsonStore. I wanted to filter the store on a certain attibute/key. The code worked fine when I used this syntax -

store.filter('status', 'complete');

However, it refused to work when I did something like
var filters = [];
filter = new Ext.util.Filter({
property: 'status',
value: 'complete'
});
filters.push(filter);
store.filter(filters);

After much digging through source code, I found that I needed to specify the root as 'data' when using the second syntax (this automatically gets added to the config when using the first strings syntax) -

filter = new Ext.util.Filter({
property: 'status',
value: 'complete',
root: 'data'
});

Thought I might save others some time, in case someone has faced a similar issue.

-Ashish