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

fastest way to add nodes on the client side

4 Answers 94 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
mirang
Top achievements
Rank 1
mirang asked on 30 Jan 2012, 05:12 AM
Which is the fastest and optimized way to add tree nodes on the client side. I am following this approach : 
var treeNodeCollection = currentNode.get_nodes();
var node = new Telerik.Web.UI.RadTreeNode();
node.set_text("Text1");
node.set_value("Value1");
treeNodeCollection.add(node);

The reason I am asking because i have nodes in thousands to add to through client, so was looking for the most optimized and fastest way to do it.

4 Answers, 1 is accepted

Sort by
0
mirang
Top achievements
Rank 1
answered on 30 Jan 2012, 11:41 AM
Actually I am creating nodes using the "LoadMore..." functionality and as an when i go on adding nodes using the above code the loading time looks to be exponentially increasing... I am loading like 200 records at one time. Looks like the get_allnodes() method after some nodes is taking more time. Please suggest...
0
mirang
Top achievements
Rank 1
answered on 31 Jan 2012, 06:36 AM
The reason why i asked this question is because by using LoadMore... functionality to add nodes, internet explorer is becomming exponentially slow if the number of nodes added start becomming more than 3000. I am using the procedure explained in the following link to add nodes from javascript : 

http://www.telerik.com/community/code-library/aspnet-ajax/treeview/radtreeview-s-addnodesto-method-as-best-performing-solution-for-creating-new-or-moving-existing-nodes-on-the-client-side.aspx 

var treeNodeCollection = new Array();
for (var nodeIndex = 0; nodeIndex < nodeLength; archiveIndex++) {
                var node = new Telerik.Web.UI.RadTreeNode();
                var data = MainDataArray[nodeIndex];
                node.set_text(data.Text);
                node.set_value(data.Value);
                var imageUrl = data.ImageUrl.replace('~\\', '');
                node.set_imageUrl(imageUrl);
                //add a dummy node to this node
                node.get_nodes().add(DummyNode());
                treeNodeCollection[nodeIndex] = node;
                nodeIndex++;
            }

treeView.addNodesTo(currentNode, treeNodeCollection);

The code works fine with chrome, but with IE it goes on becomming slower and slower.
Do we have any known issue or limitation, because our main aim is to load around 50000 nodes under one node.
0
Plamen
Telerik team
answered on 01 Feb 2012, 06:24 PM
Hello Mirang,

 
This limitation is an expected IE behavior because the script machine of IE is much slower when a large amount of  javascript and HTML is generated.
  

Kind regards,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
mirang
Top achievements
Rank 1
answered on 02 Feb 2012, 12:55 AM
Thanks for your reply.
Tags
TreeView
Asked by
mirang
Top achievements
Rank 1
Answers by
mirang
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or