search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Why onEventDelete method delete the event from frontend when click delete?

Asked by uzzal
13 days ago.

I am trying to implement delete of event. Now, when i click delete, it deletes the event which is expected, but when backend gives some kind of error and not delete it from backend, then also it gets delete.

  onEventDelete : args => {
  if (!confirm("Do you really want to delete this event?")) {

          args.preventDefault();

      }

      console.log("onEventDelete");

      console.log(args);

  },

  onEventDeleted : args => {

      // API call to delete the event on the server side

      // ...

      console.log(args);

      console.log("done");
  },
 calendar.eventDeleteHandling = "Update";

I have no backend delete implementation, still it gets deleted. I find the event when i load, but the issue is it shouldn’t be deleted.

Answer posted by Dan Letecky [DayPilot]
12 days ago.

If you want to wait for the result of an HTTP request, you need to cancel the default action using args.preventDefault() and delete the event manually using event.remove() method when the HTTP request completes. This needs to be done in onEventDelete. The onEventDeleted handler is called when the event is already removed from the UI.

New Reply
This reply is
Attachments:
or drop files here
Your name (optional):