How to use filter on grid except on empty records (ExtJS 6.5.3)

Viewed 436

I have a grid with some records and a working filter if I type something in a textfield. But I also have records which are empty in each cell. Those records should still be shown even if I use a filter. Right now those records get also filtered out.

1 Answers

You need to use filterFn on your own.

Suppose - the filtered param is age which can be null or empty string.

var ageFilterFn = new Ext.util.Filter({
    filterFn: function(item) {
        return Ext.isEmpty(item.age) || item.age < 42;
    }
});

instead of :

var ageFilter = new Ext.util.Filter({
    property: 'age',
    value: 42,
    operator: '<'
});
Related