DayPilot.Calendar.onEventDelete

The onEventDelete event handler fires when the user clicks the delete icon in the upper-right corner of an event. The icon is only visible when event deleting is enabled using DayPilot.Calendar.eventDeleteHandling in the JavaScript Calendar.

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

Declaration

DayPilot.Calendar.onEventDelete(args)

Parameters

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

  • args.preventDefault() - cancels the default action

Notes

In api=1 mode, the legacy signature is onEventDelete(e), where e is a DayPilot.Event reference.

Examples

JavaScript

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

Angular

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

React

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

Vue

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

See Also

Event Deleting [doc.daypilot.org]

DayPilot.Calendar.eventDeleteHandling

DayPilot.Calendar.onEventDeleted

DayPilot.Calendar Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript