Hello!

I have model with hasMany association (ExtJS 4.2.1.883):



Code:



Ext.define('App.model.Asset', {
extend: 'Ext.data.Model',

uses: [ ... ],
fields: [ ... ],

hasMany: [
{
name: 'devices',
model: 'App.model.Device',
foreignKey: 'assetId',
primaryKey: 'id'
}
]
});

After creating asset model automatically added filter to devices store:


Code:



exactMatch: true
filter: undefined
filterFn: undefined

initialConfig: { ... }
property: "assetId"
root: "data"
value: undefined

Next, I need to add some filters to the store and filter it (for unsaved asset model), but I get an error:


Code:



Uncaught TypeError: Cannot read property 'call' of undefined

into static method createFilterFn in Ext.util.Filter:


Code:



createFilterFn: function(filters) {
return filters && filters.length ? function(candidate) {
var isMatch = true,
length = filters.length,
i, filter;


for (i = 0; isMatch && i < length; i++) {
filter = filters[i];

if (!filter.disabled) {
isMatch = isMatch && filter.filterFn.call(filter.scope || filter, candidate);
}
}
return isMatch;
} : function() {
return true;
};
}

This is bug or am I doing something wrong?

P.S. Now I just changed createFilterFn method:



Code:



if (!filter.disabled && filter.filterFn)