scheduler drag and drop events.

I use a custom eventbox in my asp.net mvc application where I customized the eventbox to use reordering and color change based on server details very successfully. But now I have another requirement for drag and drop the eventboxes on the scheduler.
Currenly I use the click event of scheduler to populate the startime and add the default 30minutes for endtime. How to get the start time and endtime of the eventbox ? So that I can populate the start time and endtime from the dragged eventbox.

Hello,
on mouse move you can retreive id of a currently dragged event, if there any, with scheduler.getState method (client-side, js)

var id = scheduler.getState().drag_id;

docs.dhtmlx.com/scheduler/api__s … state.html

Then you’ll be able to get an event instance and acces it start and end dates

if(id){ var ev = scheduler.getEvent(id); alert(ev.start_date); alert(ev.end_date); }
docs.dhtmlx.com/scheduler/api__s … event.html

Thankyou for replying .
But I get undefined.
var id = scheduler.getState().drag_id;
I get undefined in ‘id’.
I tried to use the following method, i get undefined in ‘tid’.
scheduler.attachEvent(“onBeforeDrag”, function (event_id, mode, native_event_object) {
debugger;

var f= native_event_object;
var g = f.timeStamp;
// var id = scheduler.getState().f;
var tid = scheduler.getEvent(g);
alert(tid);
return true;
});

Hello,
‘native_event_object’ is a mousemove browser event, if you need a scheduler event - you should check the first argument.
Please note that when you start dragging on empty space of the calendar - such action initializes creation of the new event.
In this case, during the first call on onBeforeDrag ‘event_id’ will be empty. In all other cases event_id should have valid value.scheduler.attachEvent("onBeforeDrag", function (event_id, mode, native_event_object) { if(!event_id){ //right before create new event }else{ var ev = scheduler.getEvent(event_id); alert(JSON.stringify(ev)); } return true; });

I get that now. thankyou :slight_smile:
But onBeforedrag event is getting hit even on double clicking the scheduler.
Why is this happening?
In my project, we can create eventboxes both by double clicking the scheduler and dragging on scheduler. On double click I set the eventbox endtime value by default as 30 minutes added to start time. But on dragging i want the start time and end time from the eventbox. how do i prevent creating eventbox while double clicking the scheduler.?