search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Start drag and drop programatically (Scheduler)

Asked by Benedikt
20 days ago.

Hey,

is it possible, to start drag and drop using a JavaScript function? E.g. like the stop function you are already providing: https://api.daypilot.org/daypilot-scheduler-stopdragging/

This would allow to start dragging when some event/button is pressed.

Answer posted by Dan Letecky [DayPilot]
20 days ago.

That is not possible but you can activate any element to be draggable to the Scheduler using DayPilot.Scheduler.makeDraggable():

https://api.daypilot.org/daypilot-scheduler-makedraggable/

Comment posted by Benedikt
20 days ago.

Thanks for your fast reply :)

Do you have any workaround or idea, how to solve this? We would like to combine this with the make draggable. E.g. create a "hidden" div and make it draggable. After that, we would like to start the drag&drop process with that hidden div.

Comment posted by Dan Letecky [DayPilot]
20 days ago.

And what's the use case for this? Normally, it's better to keep the drag handle close to the item being dragged.

The makeDraggable() lets you specify a custom handle element (which can be different from the item) but it has to be unique for each item.

Comment posted by Benedikt
20 days ago.

We are using .net Web View 2 for WPF and want to drag and drop from outside the "browser" by using the JavaScript interops. So we stop the dragging from the windows handler and start it in the daypilot.

Comment posted by Dan Letecky [DayPilot]
20 days ago.

There is a legacy (and unsupported) method which you can use to activate external dragging:

const options = {
  id: 1,
  duration: 60, // minutes
  text: "Event",
  data: {} // object with custom properties
};
DayPilot.Scheduler.startDragging(options);

You might also want to take a look at this:
https://code.daypilot.org/63946/javascript-scheduler-dragging-items-from-desktop

New Reply
This reply is
Attachments:
or drop files here
Your name (optional):