The onEventDelete event handler fires in the JavaScript Scheduler when the user clicks the built-in delete icon.
DayPilot.Scheduler.onEventDelete(args)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
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.
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();
}
};DayPilot.Scheduler.onEventDeleted