从 ag-grid 中的行中删除复选框
Remove checkbox from rows in ag-grid
在我的 Angular 组件中,我为所有行启用了复选框选择,但实际上我试图只为可以开花的行设置一个选择框,换句话说,node.canFlower
属性是真的。
我的复选框选择是在我的组件中实现的,如下所示:
ngOnInit(): {
...
this.gridOptions.rowSelection = 'single';
this.gridOptions.suppressRowClickSelection = true;
}
我知道根据官方文档,复选框选择可以 enabled/disabled 通过函数 colDef.checkboxSelection
而 returns true/false。如何删除 node.canFlower = false
?
行的复选框
未测试,但应该接近:
const columnDefs = [
{
headerName: 'ID',
field: 'id',
checkboxSelection: function(params) {
return params.node.canFlower;
},
},
];
在我的 Angular 组件中,我为所有行启用了复选框选择,但实际上我试图只为可以开花的行设置一个选择框,换句话说,node.canFlower
属性是真的。
我的复选框选择是在我的组件中实现的,如下所示:
ngOnInit(): {
...
this.gridOptions.rowSelection = 'single';
this.gridOptions.suppressRowClickSelection = true;
}
我知道根据官方文档,复选框选择可以 enabled/disabled 通过函数 colDef.checkboxSelection
而 returns true/false。如何删除 node.canFlower = false
?
未测试,但应该接近:
const columnDefs = [
{
headerName: 'ID',
field: 'id',
checkboxSelection: function(params) {
return params.node.canFlower;
},
},
];