The onEventMoving event handler fires in the JavaScript Calendar component while an event is being dragged to a new position. You can use it to customize the moving shadow and enforce business rules before the drop is completed.
DayPilot.Calendar.onEventMoving(args)
args.e (DayPilot.Event object) - item being moved [read-only]args.start (DayPilot.Date) - current shadow start; since 2024.2.5922 the value can be modifiedargs.end (DayPilot.Date) - current shadow end; since 2024.2.5922 the value can be modifiedargs.resource (string | number) - current resource id; since 2024.2.5922 the value can be modifiedargs.html (string) - shadow HTMLargs.cssClass (string) - shadow CSS classargs.allowed (boolean) - enables or disables drop at the current positionargs.top.width (number) - width of the top text, null for autoargs.top.space (number) - distance of the top text from the shadow in pixelsargs.top.html (string) - top HTMLargs.top.enabled (boolean) - enables or disables the top textargs.bottom.width (number) - width of the bottom text, null for autoargs.bottom.space (number) - distance of the bottom text from the shadow in pixelsargs.bottom.html (string) - bottom HTMLargs.bottom.enabled (boolean) - enables or disables the bottom textconst calendar = new DayPilot.Calendar("dp", {
onEventMoving: args => {
args.html = "Moving '" + args.e.text() + "' to " + args.start.toString("MMMM d, yyyy @ h:mm tt");
},
// ...
});
calendar.init();
<daypilot-calendar [config]="config"></daypilot-calendar>
config: DayPilot.CalendarConfig = {
onEventMoving: args => {
args.html = "Moving '" + args.e.text() + "' to " + args.start.toString("MMMM d, yyyy @ h:mm tt");
},
// ...
};
<DayPilotCalendar
onEventMoving={onEventMoving}
{/* ... */}
/>
const onEventMoving = (args) => {
args.html = "Moving '" + args.e.text() + "' to " + args.start.toString("MMMM d, yyyy @ h:mm tt");
};
<DayPilotCalendar @eventMoving="onEventMoving" <!-- ... --> />
const onEventMoving = (args) => {
args.html = "Moving '" + args.e.text() + "' to " + args.start.toString("MMMM d, yyyy @ h:mm tt");
};