Hi,
I am currently attempting to create a list of events to be scheduled on a box outside the scheduler and using html5 drag and drop to create a new event on the scheduler, ideally whilst highlighting the duration of the job on the hovered area of the scheduler.
Are there any examples of this? Which methods should i call in the javascript to create the event and enable the hover highlighting?
Thanks,
Matt
Hello,
due to schedulers design, you can’t directly specify (x,y) coordinates neither for creating event at, nor for moving event to.
If you want to place event somewhere inside the scheduler - you need get calendar date related to that point and assign the date to start_date of the event and refresh the event.
You could use scheduler.getActionData(dom_event) method . It takes browser event object and returns calendar date related to event position.
So inside dragEnd handler you will have something like following:
function(domEvent){[code] var eventInfo = scheduler.getActionData(domEvent);//get event info object
var newId = scheduler.addEvent({//create new event on current date
text:'event text',
start_date:eventInfo.date,
end_date:eventInfo.date.setMinutes(eventInfo.date.getMinutes() + 30);
});[/code]
as for highlighting event duration, you may try scheduler.addMarkedTimespan
docs.dhtmlx.com/doku.php?id=dhtm … edtimespan
docs.dhtmlx.com/doku.php?id=dhtm … edtimespan
however I’m not sure that this way will have good performance. I think you can just create div for highlighting when the draggable object enters the scheduler area
please let us know if you’ll encounter any difficulties while implementing this