【发布时间】:2019-10-18 21:21:12
【问题描述】:
以下是我的服务响应,页面加载后,网格仅显示result 为yes 的行。现在,我的页面也有一个 show all 复选框,因此一旦选中该复选框,所有隐藏的行也应该是可见的,一旦我取消选中复选框,只有带有 result = yes 的行应该是可见的。如何实现此显示/隐藏行功能?请指导。以下是我目前的代码,我确实使用了refreshCells,但它没有给我预期的结果。
data = {
name: "A",
result: "no"
},
{
name: "B",
result: "no"
},
{
name: "C",
result: "yes"
},
{
name: "D",
result: "yes"
}
private gridApi;
private dataCopy;
constructor() {
this.dataCopy = data;
}
this.gridOptions = {
isExternalFilterPresent: function() {
return true;
},
doesExternalFilterPass: function(rowNode) {
return rowNode.data.result = "yes";
}
};
onGridReady(params) {
this.gridApi = params.api;
}
//function call on checkbox click
showAll(event) {
if(event.target.checked) {
this.gridApi.refreshCells(this.dataCopy);
}
}
//HTML
<input type="checkbox" (change)=showAll($event)
【问题讨论】:
-
刚看到这个。你还需要帮助吗?
标签: angular ag-grid ag-grid-angular