PDA

View Full Version : [OPEN] [CLOSED][3.0.0] Filter on MixedCollection Bug?



rvrdesigns
9 Sep 2009, 11:28 PM
I have an JsonStore which I query on a specific value for a property.
What is returned is a MixedCollection object
On this MixedCollection object i would like to filter an another property value to ensure i get the record i want.

MixedCollection.filter('property', 'value') should return me a new MixedCollection with the results.
But when I look at the code the filter call a filterBy function which will test the property, but it doesn't do it on the data fields.
it does

this.filterBy(function(o){
return o && value.test(o[property]);
});

occording to my findings it should be
value.test(o.data[property])

Condor
9 Sep 2009, 11:38 PM
This is not a bug.

Ext.data.Store.filter() and MixedCollection.filter() are not the same!

You want:

mixedCollection.filterBy(Ext.data.Store.prototype.createFilterFn('property', 'value'));

rvrdesigns
9 Sep 2009, 11:58 PM
Hm ok, I would expect the filter function of MixedCollection to filter over its data.
Apparantly it doesn't do that.

Condor
10 Sep 2009, 12:21 AM
MixedCollection does filter it's data! It's just the definition of what 'data' is:

MixedCollection.filter assumes that the data consists of objects.
Store.filter assumes that the data consists of Record instances.