External Drag-Drop , Angular scheduler

Hello,
I liked this approach of External drag-drop to scheduler fromTreeViewControl. It works perfectly fine. Is it also possible to reverse the implementation. Means Dropping scheduled appointment back to Tree View?
In above example can I move patients back to waiting list?

5 Replies 1 reply marked as answer

HB Hareesh Balasubramanian Syncfusion Team May 20, 2021 08:34 AM UTC

Hi Swarupa, 

Greetings from Syncusion Support..! 

We have prepared a sample based on your shared query “Need to provide external drop and drop support from Treeview to the Scheduler and vice-versa” using eventDragArea property, dragStop event of the Scheduler component. 


  onDragStop(args: any): void { 
    if (args.target.closest('.e-treeview')) { 
      args.cancel = true; 
      this.scheduleObj.deleteEvent(args.data); 
      let data = args.data; 
      data.Name = args.data.Name; 
      (this.treeObj.fields.dataSource as any).push(data); 
      this.treeObj.refresh(); 
   
 

  public dragArea = 'body'; 

Kindly try the above solution and get back to us if you need any further assistance. 

Regards, 
Hareesh 


Marked as answer

SN Swarupa N May 21, 2021 11:16 AM UTC

Thanks Hareesh  for the solutions. Yes it works fine.

Only one condition needs to be checked for closest target instead of '.e-treeview' better to maintain the parent class. Because if waiting list is empty, its difficult to drag and drop appointment to waiting area.

onDragStop(args: any): void {
    if (args.target.closest('.e-treeview')) {}


NR Nevitha Ravi Syncfusion Team May 24, 2021 04:18 AM UTC

Hi Swarupa, 

Thanks for you update, we are happy that our provided solution helped you. 

Regards, 
Nevitha 



SN Swarupa N June 1, 2021 12:25 PM UTC

Is it possible to highlight the drop area when we start dragging the appointment? I don't see any option to add styling when we start dragging planned appointment and drop to waiting list.


HB Hareesh Balasubramanian Syncfusion Team June 2, 2021 01:28 PM UTC

Hi Swarupa, 

Thanks for the update. 

We have modified our previously updated sample based on your shared query “Need to styling while the appointment is dropped to the waiting list (Treeview component)” using dragStop event of our Scheduler, which can be downloaded from the following link. 


  onDragStop(args: any): void { 
    if (args.target.closest('.e-treeview')) { 
      args.cancel = true; 
      this.scheduleObj.deleteEvent(args.data); 
      let data = args.data; 
      data.Name = args.data.Name; 
      data.Id = (this.treeObj.fields.dataSource as any).length + 1; 
      (this.treeObj.fields.dataSource as any).push(data); 
      this.treeObj.refresh(); 
      let treeObj = document 
        .querySelector('.e-treeview') 
        .querySelectorAll('.e-list-item'); 
      for (let i = 0; i < treeObj.length; i++) { 
        if (parseInt(treeObj[i].getAttribute('data-uid')) == data.Id) { 
          (treeObj[i] as any).style.backgroundColor = 'green'; 
        } 
      } 
    } 
  } 

Kindly try the above solution and get back to us if you need any further assistance. 

Regards, 
Hareesh 


Loader.
Up arrow icon