The onCardMoving event handler fires in real time whenever the Kanban card shadow is moved to another position during drag & drop event moving.
You can use onCardMoving to customize move validation and visual feedback while dragging, for example by forbidding selected target locations or updating the inline indicators shown next to the shadow. Available since 2025.2.6514.
Declaration
DayPilot.Kanban.onCardMoving(args)Parameters
args.allowed(boolean) - determines whether the card can be dropped at the current target locationargs.ctrl(boolean) -trueif the Ctrl key is pressed (read-only)args.shift(boolean) -trueif the Shift key is pressed (read-only)args.meta(boolean) -trueif the Meta key is pressed (read-only)args.alt(boolean) -trueif the Alt key is pressed (read-only)args.cssClass(string) - CSS class added to the moving shadowargs.card(DayPilot.Card object) - card being movedargs.column(object) - target column; the target data object is available asargs.column.dataargs.external(boolean) -trueif the card comes from an external sourceargs.html(string) - HTML of the shadow object (available since 8.3.2589)args.position(number) - position index inside the target cellargs.left.html(string) - HTML of the indicator displayed on the leftargs.left.enabled(boolean) - when set totrue, the left inline indicator is displayedargs.right.html(string) - HTML of the indicator displayed on the rightargs.right.enabled(boolean) - when set totrue, the right inline indicator is displayedargs.swimlane(object) - target swimlane; the target data object is available asargs.swimlane.data
Notes
Use this event to apply custom move rules and to update the drag shadow while the user is still moving the card. Setting args.allowed to false blocks the current drop target, and args.cssClass, args.html, args.left, and args.right let you customize the feedback displayed during the move.
Examples
JavaScript
const kanban = new DayPilot.Kanban("dp", {
onCardMoving: (args) => {
args.right.enabled = true;
args.right.html = "Move to column: " + args.column.data.name + ", " + args.position;
args.left.enabled = true;
args.left.html = "Move to column: " + args.column.data.name + ", " + args.position;
},
// ...
});
kanban.init();Angular
<daypilot-kanban [config]="config"></daypilot-kanban>config: DayPilot.KanbanConfig = {
onCardMoving: (args) => {
args.right.enabled = true;
args.right.html = "Move to column: " + args.column.data.name + ", " + args.position;
args.left.enabled = true;
args.left.html = "Move to column: " + args.column.data.name + ", " + args.position;
},
// ...
};React
<DayPilotKanban
onCardMoving={onCardMoving}
{/* ... */}
/>const onCardMoving = (args) => {
args.right.enabled = true;
args.right.html = "Move to column: " + args.column.data.name + ", " + args.position;
args.left.enabled = true;
args.left.html = "Move to column: " + args.column.data.name + ", " + args.position;
};Vue
<DayPilotKanban
@cardMoving="onCardMoving"
<!-- ... -->
/>const onCardMoving = (args) => {
args.right.enabled = true;
args.right.html = "Move to column: " + args.column.data.name + ", " + args.position;
args.left.enabled = true;
args.left.html = "Move to column: " + args.column.data.name + ", " + args.position;
};See Also
DayPilot.Kanban.cardMoveHandling
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot