DayPilot.Scheduler.onEventDelete

The onEventDelete event handler fires in the JavaScript Scheduler when the user clicks the built-in delete icon.

Declaration

DayPilot.Scheduler.onEventDelete(args)

Parameters

  • args.async (boolean) - set to true to enable asynchronous processing (available since 2023.1.5529)

  • args.e (DayPilot.Event) - item selected for deletion

  • args.control (DayPilot.Scheduler) - control instance

  • args.loaded() - continues event processing when args.async is set to true (available since 2023.1.5529)

  • args.preventDefault() - cancels the default action

Notes

In api=1 mode, the legacy signature is onEventDelete(e). When you enable asynchronous processing, set args.async to true and call args.loaded() after the custom delete workflow finishes.

Examples

JavaScript

const onEventDelete = (args) => {
  if (!confirm("Do you really want to delete this event?")) {
    args.preventDefault();
  }
};

const dp = new DayPilot.Scheduler("dp", {
  onEventDelete: onEventDelete,
  // ...
});
dp.init();

Angular

<daypilot-scheduler [config]="config"></daypilot-scheduler>
const onEventDelete = (args: DayPilot.SchedulerEventDeleteArgs) => {
  if (!confirm("Do you really want to delete this event?")) {
    args.preventDefault();
  }
};

config: DayPilot.SchedulerConfig = {
  onEventDelete: onEventDelete,
  // ...
};

React

<DayPilotScheduler
  onEventDelete={onEventDelete}
  {/* ... */}
/>
const onEventDelete = (args) => {
  if (!confirm("Do you really want to delete this event?")) {
    args.preventDefault();
  }
};

Vue

<DayPilotScheduler
  @eventDelete="onEventDelete"
  <!-- ... -->
/>
const onEventDelete = (args) => {
  if (!confirm("Do you really want to delete this event?")) {
    args.preventDefault();
  }
};

See Also

DayPilot.Scheduler.onEventDeleted

DayPilot.Scheduler.eventDeleteHandling

DayPilot.Scheduler Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript