ag-grid - 以编程方式设置集合类型过滤器时,浮动过滤器框不会更新
问题描述
当我使用 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'
解决方案
这可能是 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();
}
推荐阅读
- wordpress - 修改 Woocommerce 简码 [产品 id=""]
- java - 仅对表格中的选定行启用编辑
- webpack - 导入同一文件夹中的所有手写笔文件
- java - 谁能解释一下这个 HashMap 行为
- c++ - 我正在尝试使用 No matching function for call to 解决问题
- c# - NIC/驱动程序/OS/CLR 是否对服务器应用程序可以具有的并发请求/连接数有任何限制?
- r - fwrite(, append = TRUE) 追加错误的方式
- python - 逻辑回归获取值错误无法将字符串转换为浮点数:“?”
- c# - 百分比计算并从这些百分比输出图像 c# WPF
- python - Python:这个 datetime.strptime 解析有什么问题?