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

[Solved] Better way to traverse the tree and expand/collapse all nodes?

1 Answer 173 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Wai Kei
Top achievements
Rank 1
Wai Kei asked on 07 Feb 2011, 07:42 PM
Dear Telerik support and other members,

   Currently I have a jQuery method to expand all nodes using the following logic. For a small tree (< 50 items) it works fine. But if I have a tree structure with over 200 nodes, it takes a while before the system respond. I am thinking I might have a performance issue in traversing the tree nodes below.....Could someone please advise.

    var allNodes = $('#TreeView').find("li:has(ul)");
    $.each(allNodes, function(index, node) {    
        treeView().expand(node);
    });

Thanks,

Wai Kei

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 08 Feb 2011, 10:55 AM
Hello Wai Kei,

Try $('#TreeView').data('tTreeView').expand("li:has(ul)");

If this doesn't help, serializing the nodes as expanded from the server is your best option.

All the best,
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TreeView
Asked by
Wai Kei
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or