【问题标题】:Why Apply Button does not Work in Ag-grid Filter (agSetColumnFilter)?为什么应用按钮在 Ag-grid 过滤器 (agSetColumnFilter) 中不起作用?
【发布时间】:2022-07-05 21:12:33
【问题描述】:

我正在尝试在我的应用程序中使用带有 agSetColumnFilter 的应用和重置按钮,但它没有按预期工作。

场景:当我们尝试在搜索框中添加一些文本并单击应用时,它不会过滤。我添加了link,可以随意修改。

    { field: 'country', filter: 'agSetColumnFilter', 
      filterParams: {
          buttons: ['reset', 'apply']
      }
    }

【问题讨论】:

  • 您错误地使用了过滤器。例如,如果您只想选择澳大利亚和奥地利,则应先取消选择“(全选),搜索“Aus”,然后勾选澳大利亚和奥地利。
  • 我正在经历同样的事情。使用“应用”按钮不起作用。但是在键盘上按“Enter”似乎可以工作。我相信这是一个错误。

标签: javascript reactjs ag-grid ag-grid-react


【解决方案1】:

根据 AgGrid 文档,如果您想要相同的行为,则必须在 filterParams 中添加 'excelMode': 'windows'。

columnDefs: [
// set filters
{ 
  field: 'athlete',
  filter: true,
  filterParams: {
    buttons: ['reset', 'apply'],
    excelMode: 'windows',
  },
},

]

以下链接供您参考。

https://www.ag-grid.com/javascript-data-grid/filter-set-excel-mode/#example-excel-mode

按预期工作的代码 https://plnkr.co/edit/iZQa3eeJu807zlj3?preview

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-28
    • 2019-03-05
    • 2020-06-08
    • 2017-06-03
    • 2022-12-13
    • 2020-03-31
    • 1970-01-01
    • 2020-12-03
    相关资源
    最近更新 更多