DayPilot Forums

AJAX Calendar/Scheduling Controls
DayPilot » Forums » How To » Drag&drop from an external source

Drag&drop from an external source

Dear Dan!

Where can I find some code example about using this feature?

Thank you

Anonymous - 11/22/2007 1:54:50 PM
Example for DPC:
  • Demo/Calendar/ExternalDragDrop.aspx + .aspx.cs
Example for DPS:
  • Demo/Scheduler/Default.aspx + .aspx.cs
It works the following way:

You should activate the element to be dragged by adding the following attribute:
onmousedown='return DayPilotCalendar.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:
DayPilotCalendar.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.'); } 
dpc1.eventMoveCallBack(e, newStart, newEnd, oldColumn, newColumn);"
Dan Letecky - 11/22/2007 3:03:00 PM
Very nice explaination!
I would like to know if its possible to drag and drop items between components.
This would be very usefull to me scheduling general assignments in a users private calendar.
Could you tell me if this is possible and if so, how i can create this function?

Thanks in advance!

David
David - 11/28/2007 3:14:17 PM

I am trying to drag from one DayPilotMonth (monthview) control to another.

None of the techniques seem to work. Both ServerSide and Client-side events seem to fire on the Source control not the target. The focus rectangle DOES move outside to the target control, but it also stays within the Source control, and events only fire against the source. I have tried PostBack, CallBack and Javascript handling, and all 3 seem to have the same fault.

Any help appreciated.
Thanks in advance.

Simon Edwards
mailto:coding(REMOVEME)@(ANDME)controlbox.co(ANDMETO).uk

Simon Edwards - 2/21/2008 8:25:38 PM
Unfortunately, dragging from one DayPilot control to another one is not supported at the moment. It's scheduled as F54 Extended drag&drop support feature for release 4.7 (1 April).

External drag&drop for DayPilotMonth is not supported at all in the current version.
Dan Letecky - 2/21/2008 10:48:16 PM

OK, we might use the scheduler instead, so everything will be inside one control.
Thanks for the prompt response.

Simon Edwards - 2/22/2008 11:41:19 AM
Post reply