【问题标题】:Ag-grid hide filter columnAg-grid 隐藏过滤列
【发布时间】:2023-03-27 17:59:01
【问题描述】:

我在 Ag-grid 中有自定义过滤器。根据本网站实施: https://www.ag-grid.com/javascript-grid-filter-component

当我单击过滤器并输入一些值并单击 ApplyFilter 时,图标的过滤器将显示在标题中:

但是当我点击清除过滤器时,这个图标并没有消失。 如何隐藏这个图标?

【问题讨论】:

  • 您的“清除过滤器”按钮到底在做什么?请发布它正在调用的函数,如果可能,请发布整个自定义过滤器。
  • “清除过滤器”从输入中删除值并从ag-grid调用方法:params.filterChangedCallback();

标签: angular filter ag-grid


【解决方案1】:

根据docs,请同时使用isFilterActive函数

 isFilterActive(): boolean {
    return this.text != null && this.text !== '';
  }

过滤onChange方法请同时调用filterChangedCallback这个方法

onChange(newValue): void {
    if (this.text !== newValue) {
      this.text = newValue;
      this.params.filterChangedCallback();
    }
  }

这里正在工作Example 请通过它了解更多信息。

【讨论】:

    猜你喜欢
    • 2020-06-22
    • 1970-01-01
    • 2022-07-04
    • 2017-12-04
    • 2020-04-12
    • 2019-01-15
    • 2022-01-23
    • 1970-01-01
    • 2020-12-22
    相关资源
    最近更新 更多