[英]Issue while styling a cell on onCellValueChanged in ag-grid
I am trying to style a cell with a particular background color if the 'oldValue' and 'newValue' are not equal in the 'onCellValueChanged' handler. 如果“ onCellValueChanged”处理程序中的“ oldValue”和“ newValue”不相等,则我尝试使用特定的背景颜色设置单元格的样式。
var gridOptions = {
columnDefs: columnDefs,
rowData: rowData,
onCellValueChanged: function(params) {
if(params.oldValue !== params.newValue) {
params.colDef.cellStyle = function(params) {
return { backgroundColor: 'green'};
}
}
}
};
When I am editing the cell value to a new value, I don't see the style change being applied on tabbing out or clicking any other cell. 当我将单元格值编辑为新值时,我看不到在跳出或单击任何其他单元格时会应用样式更改。 Rather, I have to click back on the edited cell again and click outside after that to see the style being applied. 相反,我必须再次单击已编辑的单元格,然后单击外部,以查看所应用的样式。 I am not sure what is happening, can someone guide me here. 我不确定发生了什么,有人可以在这里引导我。 I am also adding the demo 我也在添加演示
Bind it to your template 绑定到您的模板
<ag-grid-angular (cellValueChanged)="onCellValueChanged($event)">
</ag-grid-angular>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.