Cancel preremove event
Cancel preremove event
alexsch
Posts: 3Questions: 1Answers: 0
Hi all,
I want to cancel a preremove event in case an integrity check fails.
Following the approach described in https://datatables.net/forums/discussion/43689 I tried to return false to cancel the preRemove event but it does not work:
Editor.on('preRemove', function (e, json) {
let canContinue = true;
$.each(data, function(index, rowId) {
canContinue = checkCanContinue(rowId);
});
if(!canContinue) {
alert('In Use.')
return false;
}
});
Any ideas?
This discussion has been closed.
Answers
Your alert statement needs a semi-colon.
Sorry, the semi-colon missed the copy & paste somehow. Nevertheless the event does not get cancelled and the row is removed.
Seems that not all pre* events can be cancelled by returning false.
This works: