Posted 14 September 2017, 11:09 am EST
Hello again Julie
This snippet shows how you can get the old and new values for a cell in the “cellEditEnding” event handler:
$scope.cellEditEnding = function(sender, e) {
// get old and new values
var flex = sender,
oldVal = flex.getCellData(e.row, e.col),
newVal = flex.activeEditor.value;
// cancel edits if the new value doesn't contain the letter 'a'
if (newVal.indexOf('a') < 0) {
e.cancel = true;
}
}
You can get the old value using the 'getCellData' method, and the new value using the 'activeEditor' property. If the new value fails validation, you can cancel the edits by setting the e.cancel property to true.
And here's how to hook up the event handler (same as any other):
As for your comments, I understand completely. We put a lot of effort in the Wijmo 5 documentation and samples, but there’s always room for improvement, so we will keep improving. And your feedback is a huge help.
I will add the snippet above to the documentation for the cellEditEnding event, I am sure it will help many users.
The “FlexGridIntro” sample is the place where we try show how you can perform common tasks. Validation is something that is missing from that sample, I will make a note to add this topic ASAP.
If you have any other requests or suggestions on how we can improve our documentation, please let me know. This is a very dear topic to me.
Thanks for helping us improve Wijmo 5.