简体   繁体   中英

sencha apply a set of filters at once

I'm trying to apply several filters at once. Because there is a listener on the filters that will retrieve information from an online store when the filters are cleared. So I need them to be replaced at once.

The filter function is being called, log messages, but somehow the result is ignored. So all items are always shown whether includeStatus is true or false.

flipElements: function (includeStatus)
{
    this.setFilters(
    [
        new Ext.util.Filter(
        {
            property: 'userName',
            value: 'me'
        }),
        new Ext.util.Filter(
        {
            filterFn: function (record)
            {
                var result = includeStatus === (record.get('statusId') === 3);
                console.log(result);
                return result;
            }
        })
    ]);
}

The problem is not that the model does not have the property because when I simply set the filter with filterBy it does show/hide the items properly.

Edit: even when the log says false it still shows the items.

setFilters only changes the filters property of the store. In order to trigger filter actions call the function filter . This is normally used to add a filter in the style 'property,value' to the filterset, but when no arguments are given it filters the store.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM