【发布时间】:2019-12-26 10:43:11
【问题描述】:
我使用refreshCells 在单击后更新特定的单元格样式。但是,这不起作用,当我设置refreshCells({ force: true }) 时,整个列都会更新我不想要的新样式。请问有什么建议吗?
vm.gridOptions = {
columnDefs: vm.columnDefs,
rowData: vm.rows,
angularCompileRows: true,
defaultColDef: {
sortable: true,
resizable: true,
},
onCellClicked: onCellClicked,
onGridReady: function (params) {
}
}
function onCellClicked(params) {
const focusedCell = params.api.getFocusedCell();
focusedCell.column.colDef.cellStyle = { 'background-color': '#b7e4ff' };
params.api.refreshCells({
force: true // this updates the whole column, not only the clicked cell
});
}
【问题讨论】: