简体   繁体   English

sencha一次应用一组过滤器

[英]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. 因此,无论includeStatus是true还是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. 问题不在于该模型没有该属性,因为当我简单地使用filterBy设置过滤器时,它确实显示/隐藏了项目。

Edit: even when the log says false it still shows the items. 编辑:即使日志显示为false,它仍然显示项目。

setFilters only changes the filters property of the store. setFilters仅更改商店的filter属性。 In order to trigger filter actions call the function filter . 为了触发过滤器动作,请调用函数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. 这通常用于向过滤器集添加样式为“属性,值”的过滤器,但是当未提供任何参数时,它将过滤存储。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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