ag-Grid onCellEditingStopped event does not provide previous value

Total
1
Shares

I am using ag-Grid onCellEditingStopped event handler to get the changed value of a grid cell.

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. But it is not a clear solution.

Thanks


Solution

you can use value Setter function for that column as below.

    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;
       }
    }
Leave a Reply

Your email address will not be published. Required fields are marked *