DayPilot.Kanban.onCardDelete

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().

Declaration

DayPilot.Kanban.onCardDelete(args)

Parameters

  • args.card (DayPilot.Card) - the card being deleted

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

  • args.preventDefault() - cancels the default delete action

Notes

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".

Examples

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();
  }
};

See Also

DayPilot.Kanban.cardDeleteHandling

DayPilot.Kanban.onCardDeleted

DayPilot.Kanban Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript