Reputation: 1
can any one help with filtering multiple condition in dojo grid. im using grid.DataGrid and json data. data1 = {items: [ {"id":1,"media":"PRINT",pt:"Yellow Directory"}, {"id":2,"media":"DIGITAL",pt:"Social Media"},{id":3,"media":"DIGITAL",pt:"Yellow Online"} ],identifier: "id"};
a=1,b=2;
grid.filter({id:a,id:b})
the above line is just displaying the record with b value. i need the record with both the values. can any one help me with this.???
Upvotes: 0
Views: 1720
Reputation: 970
So you want the records that have any of the specified ids?
It comes down to the capabilities of the store you're using. If you're using a Memory store with SimpleQueryEngine, then you can specify a regex or an object with a test function instead:
grid.filter({id: {
test: function(x) {
return x === 'a' || x === 'b';
}
}});
If you're using JsonRest store, then you get to choose how your queries are processed server-side so you could potentially pass in an array of interesting values and handle that in your own way on the server. (i.e. filter({id:[a,b]})
)
Upvotes: 0