This is a migrated thread and some comments may be shown as answers.
Adding to TreeView's DataSource shows duplicate nodes
6 Answers 60 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Danny Fritz
Top achievements
Rank 1
Danny Fritz asked on 24 Apr 2014, 09:51 PM
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.

6 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 28 Apr 2014, 03:53 PM
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!
 
0
Danny Fritz
Top achievements
Rank 1
answered on 05 May 2014, 06:39 PM
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/
0
Danny Fritz
Top achievements
Rank 1
answered on 05 May 2014, 06:42 PM
I fixed the comment to describe the correct node in this fiddle: http://jsfiddle.net/zNLNy/1203/
0
Danny Fritz
Top achievements
Rank 1
answered on 05 May 2014, 06:52 PM
If I initialize the ObservableArray before the HierarchicalDataSource it works: http://jsfiddle.net/zNLNy/1205/
0
Akhila
Top achievements
Rank 1
answered on 26 May 2015, 12:23 PM

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 :)

0
Alex Gyoshev
Telerik team
answered on 28 May 2015, 05:29 AM

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!
 
Asked by
Danny Fritz
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Danny Fritz
Top achievements
Rank 1
Akhila
Top achievements
Rank 1
Share this question
or