ag 网格:js:如何找到应用了哪个过滤器

Ash*_*ish 4 ag-grid

我有数据显示在 ag 网格中。它有 4 列名称、年龄、运动,并具有以下数据:-

数据

现在,当我根据“运动”过滤数据时,假设取消选中“空白”,我得到以下数据:- 过滤数据

1)My questions is how to get the which filter is applied on columns , like in this case "blanks" is applied on "sport".

2)If I refresh the data using api.setRowdata(), filter applied to the columns are lost

Par*_*osh 6

1.如何获取列应用了哪个过滤器

你可以得到它使用 gridApi.filterManager.allFilters

检查这个实时示例ag-grid:内置过滤器 - 记录应用的过滤器

应用ageyear过滤器,然后单击Log Filter按钮。

年龄:{列:列,filterPromise:承诺,范围:空,编译元素:空,guiPromise:{…}}
年份:{列:列,filterPromise:承诺,范围:空,编译元素:空,guiPromise:{…}}
__proto__:对象


nak*_*iin 6

从开始ag-grid@19.0.0获取设置您可以使用的所有优势应用的过滤器:

const savedModel = gridApi.getFilterModel();
gridApi.setFilterModel(savedModel);
Run Code Online (Sandbox Code Playgroud)