Scheduler: External Drag & Drop

DayPilotScheduler supports drag&drop from an external source (from outside of the calendar control).

This feature is useful for implementing the following scenario:

  • Scheduler showing the current time schedule.
  • Separate list of events that are not yet scheduled. 
  • The unscheduled events can be dragged into the calendar/scheduler.

drag1.png
Step 1: Drag the item from a list of unscheduled events.

drag2.png
Step 2: The object is detected as an event when you drag it over the calendar.

How to

You should activate the element to be dragged by adding the following attribute:

onmousedown='return DayPilotScheduler.dragStart(this.parentNode, 60*30, "123", this.innerHTML);'

It's better to add it to an inline element (<span>) rather than a block element (<div>, <li>) because block elements would become drag-sensitive in all the width (100%) and not just on the text

The dragStart parameters are as follows:

DayPilotScheduler.dragStart(elementToBeRemoved, durationInSeconds, 
valueToBePassedToMoveEvent, textToBePassedToMoveEvent);

After dropping the object the standard EventMove event is triggered (handling specified by EventMoveHandling). If you decide to handle it on the client side using JavaScript, you can detect the external source by checking the external variable (external is false when the event was dragged from another location inside the calendar):

EventMoveJavaScript="if (external) { alert('External drag&drop detected.'); } 
dps1.eventMoveCallBack(e, newStart, newEnd, newColumn);"

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java