ted
ted

Reputation: 5329

ExtJS4 store, filter 1 field by multiple values

Say i have a some store with some data:

id value
1 one
2 two
3 three
4 four

and i'd like to filter it by ID like: store.filter("id", "[1, 4]");

Is it possible? Is there also an another way to get a few values from store by id?

Upvotes: 2

Views: 5966

Answers (2)

user1354692
user1354692

Reputation: 361

store.addFilter({property: 'id', value: [1,4], operator: 'in'});

Upvotes: 0

sha
sha

Reputation: 17860

store.filter(function(r) {
    var value = r.get('id');
    return (value == 1 || value == 4);
});

Upvotes: 8

Related Questions