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

Swap events but keep duration

Related article: JavaScript Scheduler: Swapping Events (Drag and Drop)
Asked by Anonymous
12 days ago.

I was following this tutorial for swaping events

https://demos.daypilot.org/javascript-scheduler-swap-events/

Problem for me is that line of code

targetEvent.data.end = sourceEvent.data.end because event does not keep origin duration but will get one based on event which was swapped on his location.

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

The tutorial is now updated and it will keep the duration of both events after they are swapped:

  var targetDuration = targetEvent.duration();

  targetEvent.data.start = sourceEvent.data.start;
  targetEvent.data.end = targetEvent.start().addTime(targetDuration);
  targetEvent.data.resource = sourceEvent.data.resource;

https://code.daypilot.org/42265/javascript-scheduler-swapping-events-drag-and-drop

New Reply
This reply is
Your name (optional):