PDA

View Full Version : Filtering Question: Maybe a bug?



fairport
13 Sep 2011, 9:55 PM
I am needing to apply 2 filters to a data store...

I found that

This (2 separate filters) works

myStore.load();
myStore.filter({
property: "ClientID",
value: 12345,
exactMatch: true
});
myStore.filter({
property: "IsCurrent",
value: true
});

But this (an array of 2 filters) doesn’t

myStore.load();
myStore.filter({
property: "ClientID",
value: 12345,
exactMatch: true
},{
property: "IsCurrent",
value: true
});

I ONLY get ClientID filtering

Is this normal behavior?

Thanks
Roger

edspencer
13 Sep 2011, 10:46 PM
I think you'd need to wrap those filters in an array, like this:



myStore.filter([{
property: "ClientID",
value: 12345,
exactMatch: true
},{
property: "IsCurrent",
value: true
}]);

fairport
14 Sep 2011, 1:14 AM
Thanks Ed ...

But when I do that I get filtering only by "IsCurrrent"


myStore.filter([{
property: "ClientID",
value: 12345,
exactMatch: true
},{
property: "IsCurrent",
value: true
}]);

... which is the exact opposite of the effect I get without the [ ] brackets.
Without [ ]'s = filtering only by ClientID
With [ ]'s = filtering only by IsCurrent

??

Roger

edspencer
14 Sep 2011, 10:10 AM
That's very odd, I've never seen it misbehave like that before. If you're certain it's a framework bug could you file a ticket in the bugs forum and we'll take a look...

The first syntax you had above should continue to work for you (calling filter twice) but it's not a beautiful as it should be