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

[Solved] very slow while using client side add, remove tree node?

2 Answers 117 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Elton
Top achievements
Rank 1
Elton asked on 30 Mar 2008, 05:39 AM
Hi,

I m using client side code to move nodes from one tree to another.
My code here:

treeSrc.trackChanges();

treeDst.trackChanges();

var count = selectedNodes.length;

for(var i = 0; i < count; i++)

{

treeSrc.get_nodes().remove(selectedNodes[i]);

treeDst.get_nodes().add(selectedNodes[i]);

}

treeSrc.commitChanges();

treeDst.commitChanges();
...


When I work with several tree nodes it seems ok. However once I try to move 50 nodes at the same time it stucks for approximately 10sec!

Is there any problem with my code? Or some tips for this issue?

Regards,
Elton

2 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 31 Mar 2008, 11:01 AM
Hello Elton,

I tried to reproduce the problem at our side, but to no avail. Removing of 55 nodes took less than 3 seconds. Attached, please find a small and running project on the matter. Download the files and give them a go. Click on any of the "Root node 1" children and all the children will be removed.

What am I missing?

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Elton
Top achievements
Rank 1
answered on 31 Mar 2008, 10:28 PM
Thank you again Nick,

I tried your example works well.

But I think it ll be a bit slower when I apply : 

trackChanges() and commitChanges().

In my case, for 50 tree nodes it may take 3,4 seconds to move (remove and add, I m tracking changes for 2 trees) and I think that's fine now.

Thanx,
Elton

Tags
TreeView
Asked by
Elton
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Elton
Top achievements
Rank 1
Share this question
or