Home - Forums-.NET - FlyTreeView (ASP.NET) - ** Collapse all the Nodes **

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

** Collapse all the Nodes **
Link Posted: 04-Feb-2008 10:41
Hi,

Given a node of a tree view, how can I collapse all the nodes of the whole tree view. Or is there a TreeView.Collapse All function?
Link Posted: 04-Feb-2008 10:51
Like this

treeview.ExpandLevel = 0;
treeview.FindAll(delegate(FlyTreeNode node)
                           {
                               node.Expanded = null;
                               return false; // or true - doesn't matter
                           });



FindAll method recursively loops through all nodes
Link Posted: 04-Feb-2008 12:06
Sorry, not quite get it. Here is my coding:

var treeview;

//Script for flyTreeView_onInitialized() must be in the very top of the source
function flyTreeView_onInitialized(treeviewObject) {
    treeview = treeviewObject;
}

function CollapseAllNode(item, argument) {

...

}

Please file in the menu item Javascript CollapseAllNode() for me. Thanks.
Link Posted: 05-Feb-2008 06:30
Oh, I see, you need the javascript function not server-side.

Here's the same for client side:

treeview.findAll(function(node) {node.collapse();});

treeview is your client-side treeview instance.