Adding to TreeView's DataSource shows duplicate nodes

Thread is closed for posting
7 posts, 0 answers
  1. Danny Fritz
    Danny Fritz avatar
    18 posts
    Member since:
    Jul 2012

    Posted 24 Apr 2014 Link to this post

    When I modify the 'items' property on a Node in the TreeView, it clears the current children and duplicates the added children.

    Here is a jsfiddle displaying the problem.
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 28 Apr 2014 Link to this post

    Hello Danny,

    Do not wrap the Node objects manually with ObservableArrays, and use the append Node method to add child nodes. Here is the updated Fiddle.

    Regards,
    Alex Gyoshev
    Telerik
     
    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. Danny Fritz
    Danny Fritz avatar
    18 posts
    Member since:
    Jul 2012

    Posted 05 May 2014 in reply to Alex Gyoshev Link to this post

    Some of the nodes are being used in a ListView too. So, it appears they must be wrapped in an ObsrevableArray.

    I updated the JSFiddle to include the ListView: http://jsfiddle.net/zNLNy/1201/
  5. Danny Fritz
    Danny Fritz avatar
    18 posts
    Member since:
    Jul 2012

    Posted 05 May 2014 in reply to Danny Fritz Link to this post

    I fixed the comment to describe the correct node in this fiddle: http://jsfiddle.net/zNLNy/1203/
  6. Danny Fritz
    Danny Fritz avatar
    18 posts
    Member since:
    Jul 2012

    Posted 05 May 2014 in reply to Danny Fritz Link to this post

    If I initialize the ObservableArray before the HierarchicalDataSource it works: http://jsfiddle.net/zNLNy/1205/
  7. Akhila
    Akhila avatar
    2 posts
    Member since:
    May 2015

    Posted 26 May 2015 in reply to Alex Gyoshev Link to this post

    Hi Alex,

     I need to copy a parent node including child nodes while drag and drop and the source treeview items will remain same ...

    i have tried using the below code but it is only copying single node not the child nodes

     function drop(e){   

     e.preventDefault();    

    var copy = this.dataItem(e.sourceNode).toJSON();   

     if(e.dropPosition == "over"){      

       tree.append(copy, $(e.destinationNode));    

    }    ....}

     

    Thanks in advance :)

  8. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 28 May 2015 Link to this post

    Hello Akhila,

    You have to ensure that the child nodes are already loaded. As your request is not related to the topic of the OP, please open a separate thread if you require more information.

    Regards,
    Alex Gyoshev
    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