Drag-and-drop between schedulers


#1

Hello,

I am new here in the forum. I have a question regarding Drag-and-drop between schedulers, does it work in the trial version? I am replying the examples but it isn’t working. I saw this message:

The functionality is available for the Commercial, Enterprise and Ultimate licenses only.

This means that in the trial doesn’t work?

Thank you.


#2

Hello @Andre_Cruz ,

The Trial version supports all of the scheduler functionality, including the Drag-and-drop between schedulers, you can check it in the samples/20_multiple/07_drag_between.js sample the downloaded package:
https://recordit.co/y9CnIwAph2

If it doesn’t work in your case, highly likely it’s cause you didn’t add the dhtmlxscheduler_drag_between.js extension:
https://docs.dhtmlx.com/scheduler/dhtmlx_components_integration.html#draganddropbetweenschedulers

If not, could you please provide more details on how to reproduce the issue?


#3

Hello Siarhei,

I am integrating DHTMLX in Outsystems. I was trying to reproduce that sample you posted.
I am defining the schedulers like this:
function init() {
scheduler1 = Scheduler.getSchedulerInstance();
scheduler1.config.drag_in = true;
scheduler1.config.multi_day = true;
scheduler1.config.drag_move = true;
scheduler1.config.first_hour = 10;
scheduler1.init(‘scheduler_here’,new Date(2017,5,30),“week”);
scheduler1.parse(JSON.parse(JSONExample));

	scheduler2 = Scheduler.getSchedulerInstance();
	scheduler2.config.multi_day = false;
	scheduler2.config.drag_in = true;
	scheduler2.config.drag_move = true;
	scheduler2.init('scheduler_here_too',new Date(2017,5,30),"month");
	scheduler2.parse(JSON.parse(JSONExample));
		
	}

init();

And importing the files you mentioned:

I think I added everything that exists on the sample. It should be working.


#4

I’m not an OutSystems expert, but the scheduler_drag_between plugin registers event handlers on the window.onload event. Normally this event is fired after all resources have been loaded, but OutSystems is using its own ScriptsManager to fetch extra javascript files. It could be the case that the load event is fired before the dhtmlxscheduler_drag_between.js extension was loaded. So try to load the dhtmlx javascript files as early as possible. Or execute the dhtmlx logic to register the needed event listeners yourself. The drawback is off course that you have to copy some code :frowning:

function fixWindowOnLoadNotAlwaysFiringForSchedulerDnDInOutSystems() {
scheduler.event(document.body, "mousemove", function (e) {
    var t = Scheduler._external_drag, a = t.target_scheduler;
    if (a) if (t.from_scheduler) if (a._drag_id) ; else {
        var i = t.to_scheduler;
        i && !t.drag_from_scheduler(i, e) || t.land_into_scheduler(a, e)
    } else "move" == a.getState().drag_mode && a.config.drag_out && t.start_dnd(a); else t.from_scheduler && (t.to_scheduler ? t.drag_from_scheduler(t.to_scheduler, e) : t.move_dnd_holder(e));
    t.target_scheduler = null
});
scheduler.event(document.body, "mouseup", function (e) {
        var t = Scheduler._external_drag, a = t.from_scheduler, i = t.to_scheduler;
        if (a) if (i && a == i) a.updateEvent(t.drag_data.target_id); else if (i && a !== i) {
            var n = t.drag_data.ev, r = i.getEvent(t.drag_data.target_id);
            a.callEvent("onEventDropOut", [n.id, n, i, e]) ? t.move_permanently(n, r, a, i) : t.reset_event(n, a)
        } else {
            var n = t.drag_data.ev;
            a.callEvent("onEventDropOut", [n.id, n, null, e]) && t.reset_event(n, a)
        }
        t.stop_drag(), t.current_scheduler = t.from_scheduler = t.to_scheduler = null
});
}