Drag and Drop an event = copying this event

I would like to copy-paste a dragged event.
I tried this :

var dragged_event;
var dragged_mode;
var dragged_id;
scheduler.attachEvent("onBeforeDrag", function (id, mode, e){
		dragged_mode = "copy";
		dragged_mode = mode;

	dragged_id = id;
	return true;

scheduler.attachEvent("onDragEnd", function(){
	var event_obj = jQuery.extend(true, {}, dragged_event);
	if(dragged_mode == "copy")

but it’s not working. What am I doing wrong ?

Thank you,


All events should have unique id, so you can’t create a copy with the same id. Try to copy all other properties and create new event with them.

Perhaps the article about keyboard navigation would help you somehow:
docs.dhtmlx.com/scheduler/keybo … ation.html

Hello Polina,

Oh yes you are right, I forgot to respect that. Thanks.

My customers don’t want to use it. So that’s why I’m trying to find a solution using drag and drop functionality.

Made a few changes recently. I removed the updates to the DB, because I don’t know where to put it :

	function init() {
		scheduler.config.xml_date="%Y-%m-%d %H:%i";
		scheduler.init('scheduler_here',new Date(2018,0,1),"week");
		scheduler.config.drag_move = true;
		scheduler.config.drag_create = true;

		var dragged_ev;
		var date_drag;

		scheduler.attachEvent("onBeforeDrag", function (id, mode, e){ //e = mouseEvent
			if (e.ctrlKey)
				var event = scheduler.getEvent(id);
				var delta = event.end_date - event.start_date; //en ms
				var dateFin = new Date(date_drag);
				dateFin.setSeconds(dateFin.getSeconds() + (delta/100));
				dragged_ev = event;

				console.log("dateDeb : " + date_drag + " \ndateFin : " + dateFin);
				var eventId = scheduler.addEvent({
					start_date: date_drag,
					end_date:   dateFin,
					text:   "Meeting"
				id = null;
				mode = "copy";

			return true;

		scheduler.attachEvent("onMouseMove", function(event_id, native_event) {
			date_drag = scheduler.getActionData(native_event).date;

I would like to copy the dragged event to the new position. When I refresh, it finally cut the event to the new location.
I think the problem is coming from the save to the DB. How can I manually save an event ? (Triggering manually onEventSave ?)

Sorry if you already answered this question, thank you for your time.