The onCardDelete event handler fires before the default card delete action.
You can cancel the default action, which removes the card from the control when DayPilot.Kanban.cardDeleteHandling is set to "Update", by calling args.preventDefault().
DayPilot.Kanban.onCardDelete(args)args.card (DayPilot.Card) - the card being deleted
args.control (DayPilot.Kanban) - control instance
args.preventDefault() - cancels the default delete action
Use this event to confirm deletion or replace the built-in delete workflow with custom logic. When the delete is allowed to continue, the card is removed from the control if DayPilot.Kanban.cardDeleteHandling is set to "Update".
JavaScript
const kanban = new DayPilot.Kanban("dp", {
cardDeleteHandling: "Update",
onCardDelete: (args) => {
if (!confirm("Do you really want to delete this card?")) {
args.preventDefault();
}
},
// ...
});
kanban.init();Angular
<daypilot-kanban [config]="config"></daypilot-kanban>config: DayPilot.KanbanConfig = {
cardDeleteHandling: "Update",
onCardDelete: (args) => {
if (!confirm("Do you really want to delete this card?")) {
args.preventDefault();
}
},
// ...
};React
<DayPilotKanban
cardDeleteHandling="Update"
onCardDelete={onCardDelete}
{/* ... */}
/>const onCardDelete = (args) => {
if (!confirm("Do you really want to delete this card?")) {
args.preventDefault();
}
};Vue
<DayPilotKanban
cardDeleteHandling="Update"
@cardDelete="onCardDelete"
<!-- ... -->
/>const onCardDelete = (args) => {
if (!confirm("Do you really want to delete this card?")) {
args.preventDefault();
}
};