How to use FilterBy Method in Extjs local store

65 Views Asked by At

Im new to Extjs 7.6 and using Sencha Architect. I changed a remote filtered store to a local store.

How do i use the filterBy function in my controller? I have read some examples but dont really understand.

The value is given by an input field.

Following my remote filter method:

application.getStore('ServiceStore').filter(
     [{id: 'number', property: 'number', value: value, operator: 'LIKE', andor:'OR'},
     {id: 'description', property: 'description', value: value, operator: 'LIKE', andor:'OR'}]
);

How to translate this to a local filterBy method?

1

There are 1 best solutions below

0
Tech-Maou On BEST ANSWER

I have found the answer:

store = application.getStore('ServiceStore');
store.filter(new Ext.util.Filter({
    filterFn: function(item) {
        if (item.data.number.indexOf(value) > -1 || item.data.description.indexOf(value) > -1) {
            return true;
        } else {
            return false;
        }
    }
}));