TreeView dragAndDrop to copy not to move

4 posts, 0 answers
  1. Rodrigo
    Rodrigo avatar
    2 posts
    Member since:
    Mar 2013

    Posted 29 Mar 2013 Link to this post

    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 :)
  2. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 02 Apr 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Akhila
    Akhila avatar
    2 posts
    Member since:
    May 2015

    Posted 26 May 2015 in reply to Daniel Link to this post

    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

  5. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 28 May 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready