This is a migrated thread and some comments may be shown as answers.

[Solved] client-side adding of nodes

1 Answer 141 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mitch Milam
Top achievements
Rank 1
Mitch Milam asked on 26 Apr 2008, 04:45 PM
I ran into an interesting issue this morning that I could use an opinion on.

I have the following event defined to fire OnClientNodeChecking:

function AfterClientCheck(sender, eventArgs)
{
 var node = eventArgs.get_node(); 
 var secondTreeView = $find('RadTreeView4');
 secondTreeView.get_nodes().add(node);
}

The code is supposed to make a copy of a node from one treeview and add it to a second treeview.

Only it doesn't just Add it, it actually MOVES it from one treeview to the other.

Is this by design?

Anyway, the solution I found to work around this issue is to create a new node:

var node3 = new Telerik.Web.UI.RadTreeNode();
node3.set_text(node.get_text());
secondTreeView.get_nodes().add(node3);

Thanks, Mitch

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 29 Apr 2008, 10:13 AM
Hello Mitch Milam,

Indeed this behavior is by design. You cannot have one node to exist in more than one treeview. That is why you need to clone the node just the way you did it in your solution.

Regards,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
Mitch Milam
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or