【发布时间】:2021-11-05 09:48:16
【问题描述】:
我正在使用 ag-grid 角度组件,需要一个功能来将文本包装在需要通过复选框控制的单元格中。
【问题讨论】:
标签: ag-grid
我正在使用 ag-grid 角度组件,需要一个功能来将文本包装在需要通过复选框控制的单元格中。
【问题讨论】:
标签: ag-grid
只需将cellClassRules 添加到列:-
cellClassRules: {
'wrap-text': params => {
return params.data.checkboxColumn === true;
},
'no-wrap-text': params => {
return !params.data.checkboxColumn;
}
},
将信息存储在数组中
this.checkBoxInfo = []; // 使用 api.refreshCells({force:true})
cellClassRules: {
'wrap-text': params => {
// add condition using `this.checkBoxInfo` and return
// true/false
return true/false;
},
'no-wrap-text': params => {
// add condition using `this.checkBoxInfo` and return
// true/false
return true/false;
}
},
【讨论】: