We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Drag&Drop

Hello!
How to drag&drop from my own custom component to the scheduler?
I have a list (i.e. regular HTML divs) and I need to make an event by dragging elements onto scheduler. I've tried to make use of CDK Drag&Drop API  and Draggable/Droppable from syncfusion base, but I had no luck in both cases.
Do you have an example how I can achieve it? Is it possible at all?

3 Replies

VM Vengatesh Maniraj Syncfusion Team September 6, 2019 03:15 PM UTC

Hi Artem, 
 
Syncfusion Greetings. 
 
Kindly check the below sample which illustrates how to drag and drop from external into Schedule. In this sample we can drag and drop the items from TreeView  component into Schedule. 
 

Kindly revert us if you have any further assistance. 

Regards, 
Vengatesh 



UN Unknown Syncfusion Team September 9, 2019 09:05 AM UTC

Hello, thank you for reply!
I saw that example, unfortunately I can not use it. 
My external events are not in TreeView component, they are regular HTML divs so that they don't have any events like nodeDragStop or nodeDragging.
I would appreciate an example of the external dragging using regular HTML as a source of events.


KK Karthigeyan Krishnamurthi Syncfusion Team September 11, 2019 08:36 AM UTC

Hi Artem, 
 
Thanks for the update. 
 
We have prepared the sample as per requirement, kindly refer the below links. 
 
ngAfterViewInit() { 
        let draggable: Draggable = new Draggable(document.getElementById('draggable'), {clone: false}); 
        let droppable: Droppable = new Droppable(document.getElementById('droppable'), { 
            drop: (e: DropEventArgs) => { 
              var obj = ((document.getElementsByClassName('e-schedule'))[0] as any).ej2_instances[1]; 
              let data = obj.getCellDetails(e.target); 
              let Appointment = { Subject: "New Event", StartTime: data.startTime, EndTime: data.endTime,IsAllDay: data.isAllDay}; 
              obj.openEditor(Appointment, 'Add', true); 
              document.querySelector('#draggable').remove() 
            } 
        }); 
    } 
 
Regards, 
Karthi 
 


Loader.
Live Chat Icon For mobile
Up arrow icon