[英]ag-Grid onCellEditingStopped event does not provide previous value
I am using ag-Grid onCellEditingStopped event handler to get the changed value of a grid cell.我正在使用 ag-Grid onCellEditingStopped事件处理程序来获取网格单元格的更改值。
onCellEditingStopped: function(event) {
// event.value present the current cell value
console.log('cellEditingStopped');
}
But it does not provide the previous value (the value before the change happens).但它不提供先前的值(更改发生前的值)。 Is there anyway to get the previous value ?反正有没有得到以前的价值?
My current solution:我目前的解决方案:
I am using onCellEditingStarted event to store the current cell value in a separate variable and use that variable inside the onCellEditingStopped event handler function.我正在使用onCellEditingStarted事件将当前单元格值存储在一个单独的变量中,并在onCellEditingStopped事件处理函数中使用该变量。 But it is not a clear solution.但这并不是一个明确的解决方案。
Thanks谢谢
you can use value Setter function for that column as below.您可以为该列使用值 Setter 函数,如下所示。
valueSetter: function (params) {
console.log(params.oldValue);
console.log(params.newValue);
if (params.oldValue !== params.newValue) {
//params.data["comments"] = params.newValue;
return true;
}
else {
return false;
}
}
I'm using onCellEditingStopped
in my Angular application, with agGrid v24.1... and it does have an oldValue
and a newValue
value in there.我在我的 Angular 应用程序中使用onCellEditingStopped
和 agGrid v24.1 ...,它确实有一个oldValue
和一个newValue
值。
onCellEditingStopped = (_params) => {
if (_params.newValue != _params.oldValue) {
// Do something...
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.