|
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?
|
|
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!
|
|
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.
|
|
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!
|
|
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.
|
|
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!
|
|