PDA

View Full Version : Store filtering using Boolean alternative



rafallo
29 Aug 2011, 3:47 AM
Hi,

how can I filter records in store when I want to use few parameters join by Boolean alternative (OR) ?

skirtle
30 Aug 2011, 6:05 AM
Local or remote filtering?

For local you can do:


store.filterBy(function(record) {
return record.get('type') === 4 || record.get('category') === 6;
});

rafallo
30 Aug 2011, 6:35 AM
Remotely.

I implemented it by add extraParams to proxy and handle this on server-side.
Is any better solution?

skirtle
30 Aug 2011, 6:55 AM
extraParams is one way. FiltersFeature does it by changing the parameters in a beforeload listener. From the server's point of view both approaches are the same, just depends what makes sense in your UI.