Drag and Drop Scheuler MONTH View


#1

Hello All!

I was able to make a dragging action on scheduler in Day and Week view using below code:

var old = scheduler._render_v_bar;
scheduler._render_v_bar = function () {
  var container = old.apply(this, arguments);

  //assign custom drag handler to event blocks
  container.setAttribute("draggable", "true");
  container.ondragstart = drag;

  return container;
}

But this does not work on month view of the scheduler.
Any ideas on what element i should edit in Scheduler MONTH view to achieve drag action on scheduler entries?

Thank you!


#2

Hi @Asyong,

Firstly, I should notify you that redefining the internal methods of the scheduler may cause some unexpected issues, and also can break the scheduler functionality on updates to new versions. So I advise you to be careful with it.

Also, you can define some additional logic to the events dragging using drag events, without changing the internal gantt methods:
onEventDrag :
https://docs.dhtmlx.com/scheduler/api__scheduler_oneventdrag_event.html
onDragEnd:
https://docs.dhtmlx.com/scheduler/api__scheduler_ondragend_event.html
onBeforeDrag:
https://docs.dhtmlx.com/scheduler/api__scheduler_onbeforedrag_event.html

Regarding the question:
The _render_v_bar method is used to render events for less than one day(.dhx_cal_event).
In the month view, all events display as multiday events(dhx_cal_event_line) which render by the render_event_bar method, which works differently and takes the event object as the parameter.


#3

Hello @Siarhei

Thanks for the response.
I need to implement my own drag event because i need to drag it out of the scheduler.