以编程方式设置设置类型过滤器时,浮动过滤器框不会更新

时间:2019-08-09 03:58:21

标签: ag-grid ag-grid-react

当我使用selectvalue API以编程方式控制基于集合的过滤器时,浮动过滤器窗口不会更新。

如果您从浮动过滤器窗口中手动选择和取消选择,则效果很好。

请参见https://plnkr.co/edit/707g7FHCPOOi26AlUpyn?p=preview

单击API:仅过滤John Joe Nevin和Kenny Egan,它将正确过滤,但Athlete的浮动过滤器框为空。

如果打开它旁边的漏斗,则表示过滤器正确。取消选择其他内容,然后在浮动过滤器输入框中正确显示运动员的姓名。

我想念什么吗?

//Code used to perform the filter.
var athleteFilterComponent = this.gridApi.getFilterInstance("athlete");
athleteFilterComponent.selectNothing();
athleteFilterComponent.selectValue("John Joe Nevin");
athleteFilterComponent.selectValue("Kenny Egan");
this.gridApi.onFilterChanged();

//Turn this option on as well.
floatingFilter='true'

1 个答案:

答案 0 :(得分:0)

这可能是ag-grid中的错误。
但是,解决方法是使用setModel() api。像这样的东西-

  selectJohnAndKenny() {
    var athleteFilterComponent = this.gridApi.getFilterInstance("athlete");
    athleteFilterComponent.selectNothing();
    var model = ["John Joe Nevin", "Kenny Egan"];
    athleteFilterComponent.setModel(model);
    this.gridApi.onFilterChanged();
  }