DayPilot.Month.onEventDelete

The onEventDelete callback fires when the user clicks the event delete icon displayed on the right side of calendar events. The delete icon is only visible when event deleting is enabled using DayPilot.Month.eventDeleteHandling in the monthly calendar.

This callback fires before the item is actually removed from the calendar. Call args.preventDefault() to cancel the default action. See also DayPilot.Month.onEventDeleted, which is called after the event is removed.

Declaration

DayPilot.Month.onEventDelete(args)

Parameters

  • args.e (DayPilot.Event) - deleted item reference

  • args.preventDefault() - cancels the default action

Notes

Use this handler when you need to confirm or block deletion before the built-in delete action runs. After the event is removed, DayPilot.Month.onEventDeleted fires.

Examples

JavaScript

const month = new DayPilot.Month("dp", {
  eventDeleteHandling: "Update",
  onEventDelete: (args) => {
    if (args.e.id() === "3") {
      args.preventDefault();
    }
  },
  // ...
});
month.init();

Angular

<daypilot-month [config]="config"></daypilot-month>
config: DayPilot.MonthConfig = {
  eventDeleteHandling: "Update",
  onEventDelete: (args) => {
    if (args.e.id() === "3") {
      args.preventDefault();
    }
  },
  // ...
};

React

<DayPilotMonth
  eventDeleteHandling="Update"
  onEventDelete={onEventDelete}
  {/* ... */}
/>
const onEventDelete = (args) => {
  if (args.e.id() === "3") {
    args.preventDefault();
  }
};

Vue

<DayPilotMonth
  eventDeleteHandling="Update"
  @eventDelete="onEventDelete"
  <!-- ... -->
/>
const onEventDelete = (args) => {
  if (args.e.id() === "3") {
    args.preventDefault();
  }
};

See Also

Event Deleting [doc.daypilot.org]

DayPilot.Calendar.eventDeleteHandling

DayPilot.Month.onEventDeleted

DayPilot.Month Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript