【问题标题】:sencha apply a set of filters at oncesencha 一次应用一组过滤器
【发布时间】:2014-11-24 10:16:06
【问题描述】:

我正在尝试一次应用多个过滤器。因为过滤器上有一个侦听器,当过滤器被清除时,它将从在线商店检索信息。所以我需要立即更换它们。

正在调用过滤器函数,记录消息,但不知何故,结果被忽略了。所以无论 includeStatus 是真还是假,所有的项目都会显示出来。

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;
            }
        })
    ]);
}

问题不在于模型没有属性,因为当我简单地使用 filterBy 设置过滤器时,它确实正确显示/隐藏了项目。

编辑:即使日志显示为 false,它仍会显示项目。

【问题讨论】:

    标签: javascript extjs filter sencha-touch-2.3


    【解决方案1】:

    setFilters 仅更改商店的过滤器属性。为了触发过滤器动作,调用函数filter。这通常用于向过滤器集添加样式为 'property,value' 的过滤器,但是当没有给定参数时,它会过滤存储。

    【讨论】:

      猜你喜欢
      • 2011-09-05
      • 2018-04-23
      • 1970-01-01
      • 2015-01-02
      • 1970-01-01
      • 2020-12-02
      • 2015-11-10
      • 2011-09-15
      相关资源
      最近更新 更多