Welcome Guest Search | Active Topics | Sign In | Register

TreeView Collapse All Options
Shawn
Posted: Friday, February 27, 2009 12:40:09 PM
Rank: Member
Groups: Member

Joined: 4/30/2008
Posts: 21
I see that there is an ExpandAll function for the treeview control. Why is isn't there a CollapseAll? Any suggestions on how to do a collapse all without traversing all the nodes?
eo_support
Posted: Friday, February 27, 2009 1:21:44 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Actually the only way to do it is to traversing all nodes. That is how ExpandAll is implemented.

Thanks!
Shawn
Posted: Friday, February 27, 2009 1:59:11 PM
Rank: Member
Groups: Member

Joined: 4/30/2008
Posts: 21
I figured that is how ExpandAll worked, I was just wondering why there isn't a collapse all. At this point however, I don't think it matters. It takes way too long to expand and collapse the nodes (just over 100 nodes) anyway so we will probably not implement this feature on our web site.
eo_support
Posted: Friday, February 27, 2009 2:17:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

There probably should a CollapseAll. I believe the reason that it is not there is because by default he TreeView is all collapsed, so a CollpaseAll call is rarely needed.

Thanks!
Shawn
Posted: Friday, February 27, 2009 2:28:59 PM
Rank: Member
Groups: Member

Joined: 4/30/2008
Posts: 21
Normally that is probably ok, but in our case we "memorize" which nodes are expanded and re-expand the nodes between server requests. So, in our case, the tree is not always collapsed.

Secondly, why does it take so long for the nodes to expand and collapse? I just finished a phone conversation with the CIO and we can't have a expand all / collapse all feature because it takes too long to expand and collapse nodes. Like I said in my previous post, on average, there are approximately 100 nodes.

Thanks.
eo_support
Posted: Friday, February 27, 2009 2:42:34 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Collapse should be rather quick. Expand is what costs time. The TreeView is optimized for "normal circumstance" where most nodes are collapsed and works efficiently that way by delaying tree node creating/initializing till the node actually needs to be visible (usually when user expands the parent node). When you expand all nodes, instead of only loading a few visible nodes on page load, it now load a lot more, which causes the significant time delay you saw.

As to your project, "memorize" which nodes are expanded and re-expand them are usually fine because user will rarely manually expand all nodes, unless you have a button for them to "Expand All". From usability point of view, "Expand All" may not be a good option. A TreeView is useful to user because it allows user to see/navigate hierarchically data in a drill-down fashion. Displaying all nodes at once can make it less user friendly because there are too many nodes in front of them and makes it harder for them to find the right one.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.