Search code examples
javascriptextjssencha-architect

Filter store records that do not match a value


In ExtJS I would create a filter like this:

store.addFilter({property: 'teamName', value: teamName});

This would filter all records with a teamName of value teamName.

How would I filter it so that it shows all records that DO NOT have this value for this field?


Solution

  • Use filterFn:

    A custom filter function which is passed each item in the Ext.util.MixedCollection in turn. Should return true to accept each item or false to reject it.

    For example:

    store.addFilter({
        filterFn: function(record){
            return record.get('teamName') !== 'teamName';
        }
    });