【问题标题】:setFilterModel doesnt perform filtering if filter is {type: 'equals' and filter: ''}如果 filter 是 {type: 'equals' and filter: ''} setFilterModel 不执行过滤
【发布时间】:2018-10-20 20:38:47
【问题描述】:

我正在使用:

gridOptions.api.setFilterModel(filterModel);

var filterModel = { country: { type: 'equals', filter: '' } };

所以我希望网格将返回所有带有空“国家”的行,但看起来网格会忽略通过过滤器的过滤器:“”

我也尝试将 [null] 作为值:

filterModel = { country: { type: 'equals', filter: [null] } };

在这种情况下,我在列标题附近看到过滤器指示器,但行是相同的

也许我错过了文档中的某些内容...

这里是例子 https://plnkr.co/edit/aA7D4At58yg7AqwD1qxc?p=preview

也许有人可以说如何对空白值执行过滤

【问题讨论】:

    标签: ag-grid


    【解决方案1】:

    看看这个 github 问题

    https://github.com/ag-grid/ag-grid/issues/2712

    希望对你有帮助

    【讨论】:

      【解决方案2】:

      现在它不适用于 agGrid 希望他们能尽快添加 https://github.com/ag-grid/ag-grid/issues/2712

      【讨论】:

        【解决方案3】:

        作为一种解决方法,我们在填充网格之前用单个空格“”替换空值。
        然后您可以使用通常的setFilterModel 进行过滤,以过滤掉带有单个空格的行。

        希望这会有所帮助!

        【讨论】:

          猜你喜欢
          • 2021-04-02
          • 1970-01-01
          • 2019-06-22
          • 2016-11-14
          • 2011-09-20
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多