The onCardMove event handler fires when Kanban card dragging finishes and the card is dropped at the target position, but before the card is actually moved. You can cancel the move or switch to asynchronous processing here.
Declaration
DayPilot.Kanban.onCardMove(args)Parameters
args.async(boolean) - set totrueto enable asynchronous processing (available since 2024.2.5912)args.card(DayPilot.Card object) - card being movedargs.column(DayPilot.Column object) - target columnargs.control(DayPilot.Kanban) - control instanceargs.position(integer) - target position inside the destination cellargs.previous(DayPilot.Card object) - card preceding the target positionargs.next(DayPilot.Card object) - card following the target positionargs.swimlane(DayPilot.Swimlane object) - target swimlaneargs.preventDefault()- cancels the default actionargs.loaded()- continues processing in asynchronous mode (available since 2024.2.5912)
Notes
The built-in drop action is controlled by DayPilot.Kanban.cardMoveHandling. When it is set to "Update", the card location is updated on the client side after this handler completes.
The source data object is accessible as args.card.data. Set args.async = true before returning if you need asynchronous validation, and call args.loaded() when the custom processing finishes.
Examples
JavaScript
const dp = new DayPilot.Kanban("dp", {
cardMoveHandling: "Update",
onCardMove: (args) => {
if (!confirm("Do you really want to move this card?")) {
args.preventDefault();
}
},
// ...
});
dp.init();Angular
<daypilot-kanban [config]="config"></daypilot-kanban>config: DayPilot.KanbanConfig = {
cardMoveHandling: "Update",
onCardMove: (args) => {
if (!confirm("Do you really want to move this card?")) {
args.preventDefault();
}
},
// ...
};React
<DayPilotKanban
cardMoveHandling="Update"
onCardMove={onCardMove}
{/* ... */}
/>const onCardMove = (args) => {
if (!confirm("Do you really want to move this card?")) {
args.preventDefault();
}
};Vue
<DayPilotKanban
cardMoveHandling="Update"
@cardMove="onCardMove"
<!-- ... -->
/>const onCardMove = (args) => {
if (!confirm("Do you really want to move this card?")) {
args.preventDefault();
}
};See Also
DayPilot.Kanban.cardMoveHandling
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot