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.
Declaration
DayPilot.Calendar.onEventMoving(args)
Parameters
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,nullfor 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,nullfor 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 text
Examples
JavaScript
const 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();
Angular
<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");
},
// ...
};
React
<DayPilotCalendar
onEventMoving={onEventMoving}
{/* ... */}
/>
const onEventMoving = (args) => {
args.html = "Moving '" + args.e.text() + "' to " + args.start.toString("MMMM d, yyyy @ h:mm tt");
};
Vue
<DayPilotCalendar @eventMoving="onEventMoving" <!-- ... --> />
const onEventMoving = (args) => {
args.html = "Moving '" + args.e.text() + "' to " + args.start.toString("MMMM d, yyyy @ h:mm tt");
};
See Also
- Event Moving [doc.daypilot.org]
- DayPilot.Calendar.eventMoveHandling
- DayPilot.Calendar Class
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot