I am trying to cancel a change of value after editing a cell. The flow is :
- finish edition ( onCellValueChanged )
- request to web service:
- if request fail cancel edition ( reverse to old value ).
- if request is ok nothing to do
Fot that I try to use the gridOptions.onCellValueChanged listener, which works but the event.newValue is the same as event.oldValue:
this.gridOptions.onCellValueChanged = event => {
// Here event.newValue == event.oldValue
}
The cell model is an object (not a string or a simple type ). So I tracked down the problem to maybe the redefinition of equals within the coldef :
coldef: {
/* a lot of def ...*/
equals: function(object1, object2) {
console.log("equal : ", object1, object2);
return object1.Id === object2.Id;
},
};
But here ont the log object1 and object2 are undefined. Why is that ? And bonus question : is this the good way to cancel the change of cell data ?