PDA

View Full Version : [OPEN] Filter - fake warning - A Filter requires either a property or a filterFn to be set



LesJ
9 Oct 2014, 9:02 AM
Try this code.
I'm seeing a warning: [W] A Filter requires either a property or a filterFn to be set

I think I should not be seeing this warning since the filterFn is set as a config (http://docs-origin.sencha.com/extjs/5.0.1/#!/api/Ext.util.Filter-cfg-filterFn).

Fiddle (https://fiddle.sencha.com/#fiddle/bj0)


var allNames = new Ext.util.MixedCollection();


allNames.addAll([
{ id: 1, name: 'Ed', age: 25 },
{ id: 2, name: 'Jamie', age: 37 },
{ id: 3, name: 'Abe', age: 32 },
{ id: 4, name: 'Aaron', age: 26 },
{ id: 5, name: 'David', age: 32 }
]);


Ext.define('NameFilter', {
extend: 'Ext.util.Filter',
config: {
filterFn: function (item) {
console.log(item.name.length);
return item.name.length > 4;
}
}
});


var nameFilter = new NameFilter({value: 'xxx'});


var longNames = allNames.filter(nameFilter);

Gary Schlosberg
9 Oct 2014, 1:55 PM
Thanks for the report! I have opened a bug in our bug tracker.

LesJ
3 Dec 2014, 12:59 PM
Misleading warnings can be annoying. This defect is still present in the nightly build (FYI).

LesJ
3 Feb 2015, 6:53 AM
Similar fake warning when extending the Filter class. In this case the warning should state that the filterFn method is not specified.

Ext.define('MyFilter', {
extend: 'Ext.util.Filter'
});

new MyFilter();

51661