React组件Ag-grid filterChangedCallback不会触发doesFilterPass

时间:2017-01-22 17:34:07

标签: reactjs ag-grid-react

我试图以编程方式使过滤器在组件加载时运行doesFilterPass。到目前为止,我已经尝试将filterChangedCallback添加到componentWillMount,componentDidMount,componentWillUpdate和componentDidUpdate调用。但是,这些调用都不会触发doesFilterPass。从gui触发filterChangedCallback,像onChange这样的事件处理程序确实有效。这是一个错误吗?有谁知道如何始终如一地运行didFilterPass?

2 个答案:

答案 0 :(得分:0)

我和ag-grid的那些人交谈过。他们称之为控制的限制。所以我最终使用componentDidUpdate处理程序的计时器300毫秒来调用filterChangedCallback。这是一个可怕的解决方案,但它确实有效。

答案 1 :(得分:0)

我遇到了同样的问题,所以我从这里ag-grid-react-example下载了示例反应代码并阅读了代码。

尝试在 this.SetState 中调用 filterChangedCallback(),如下所示:

this.setState({stateList}, this.props.filterChangedCallback);

它对我有用。