PDA

View Full Version : Applying Filer to Data.store



qazs
2 Aug 2010, 1:10 AM
Hi, I'm trying to get filtering to work on a data.store which stores json result but can't. In the end I came up with this:

var filter = new Ext.util.MixedCollection({});
filter.addAll(result);
f = filter.filter('id', 1);
Data.store.loadData(f.getRange());

Is there a more straightforward method, like Data.store.filter('uid', 1)?
I don't understand the explanation in the manual.
Thanks for any help.

cnelissen
2 Aug 2010, 1:05 PM
This should work:

Data.store.filter({property: 'uid', value: 1});

The docs are very confusing about this though, I agree. You are actually passing a configuration which is getting passed to a new instance of Ext.util.MixedCollection.filter... Seems like the filter should just be made available on the store directly.

qazs
2 Aug 2010, 5:18 PM
Thanks, it works!

aecontrerasl
8 Nov 2010, 1:09 PM
It worked for me too.

Hey Sencha Team, could you include this example into the API Docs?


Thanks cnelissen.

edspencer
9 Nov 2010, 2:09 AM
It worked for me too.

Hey Sencha Team, could you include this example into the API Docs?


Thanks cnelissen.

The new Release Candidate docs for Store now contain examples for filtering and sorting stores - check out http://dev.sencha.com/deploy/touch/docs/?class=Ext.data.Store