The registerDropTarget() method registers an external element, typically a list of unscheduled events, as a drop target for Scheduler events dragged out of a DayPilot.Scheduler instance with dragOutAllowed set to true.
This is a static method. Call it using the full prefix, not on a DayPilot.Scheduler instance.
Available since 2021.2.4931.
Declaration
DayPilot.Scheduler.registerDropTarget(options)Parameters
options.element(DOM element) - DOM node activated as the external drop targetoptions.onDragEnter- event handler fired when the dragged event enters the target; available since 2025.4.6742options.onDragLeave- event handler fired when the dragged event leaves the target; optionaloptions.onDragOver- event handler fired continuously while the dragged event is over the target; optionaloptions.onDrop- event handler fired when the dragged event is dropped on the target; optional
The event handlers receive an args object with the following property:
args.e(DayPilot.Event) - source event being dragged
Example
DayPilot.Scheduler.registerDropTarget({
element: document.getElementById("queue"),
onDrop: (args) => {
const parent = document.getElementById("external");
const li = document.createElement("li");
li.setAttribute("data-duration", args.e.duration().totalHours());
li.setAttribute("data-id", args.e.id());
li.style.cursor = "move";
li.innerText = args.e.text();
parent.appendChild(li);
makeDraggable();
dp.events.remove(args.e);
},
});See Also
DayPilot.Scheduler.dragOutAllowed
DayPilot.Scheduler.makeDraggable()
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot