Data Table Editor Event

Data Table Editor Event

mazoonmazoon Posts: 1Questions: 1Answers: 0

Hi,
I am trying to check some condition before allow user to click "New" button

Editor.on('initCreate', function () {
  if (SelectStatus !== 'Y') {
    alert("Pleae Select !!!!!!");
      return false;
    }
  else 
     return true;
});

I am getting alert but after alert it shows Lightbox for adding new record.
How to prevent show the lightbox dialog if condition not match ??

Answers

  • allanallan Posts: 63,850Questions: 1Answers: 10,519 Site admin

    The initCreate event is not cancellable which is why the above code won't really do anything. Instead, what you need to do is use the preSubmit event which is cancellable and will stop the user from being able to submit without your condition being satisfied.

    Allan

This discussion has been closed.