This is a migrated thread and some comments may be shown as answers.
TreeView dragAndDrop to copy not to move
3 Answers 100 Views
This is a migrated thread and some comments may be shown as answers.
Rodrigo
Top achievements
Rank 1
Rodrigo asked on 29 Mar 2013, 04:53 PM
In the TreeView drag and drop example, when yo drag one node from the left tree to the right one, the item is removed from the left tree and added to the right one. It is posible to keep the node on the left tree after dragging is complete?

Thanks in advance :)

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 02 Apr 2013, 11:23 AM
Hello Rodrigo,

This is not supported out of the box but can be achieved by using the drop event to prevent the default action and add a copy of the data to the other TreeView by using its API.

function drop(e){
    e.preventDefault();
    var copy = this.dataItem(e.sourceNode).toJSON();
    if(e.dropPosition == "over"){
         tree.append(copy, $(e.destinationNode));
    }
    ....
}
Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Akhila
Top achievements
Rank 1
answered on 26 May 2015, 10:51 AM

How to copy parent node including child nodes ...i have tried using the above solution but it is copying only one node

If i drag and drop a parent node all the child nodes should also be dragged and dropped and the source should also remain the same

0
Daniel
Telerik team
answered on 28 May 2015, 08:35 AM
Hello,

Could you provide the code that you are using for the treeviews? As long as the data schema is the same, the child nodes should also be copied with this approach(live demo).

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Asked by
Rodrigo
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Akhila
Top achievements
Rank 1
Share this question
or