pcirella / dynatree

Automatically exported from code.google.com/p/dynatree
0 stars 0 forks source link

Proposed new feature: hide siblings #225

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'd like to suggest some additional functionality: when a node is expanded, the 
siblings of the expanded node are hidden. Closing an expanded node should 
unhide its siblings.

This makes it easier to focus on only the path down to the most-expanded nodes, 
which is particularly helpful when there is a large number of children for some 
(most?) of the nodes. 

The following patch against $Revision 520 works for me(tm), but the
default for autoHide should probably be false:

--- jquery.dynatree.js~ 2011-08-16 09:23:24.000000000 +0200
+++ jquery.dynatree.js  2011-08-25 08:58:02.988172500 +0200
@@ -1056,6 +1056,17 @@
                                parents[i].collapseSiblings();
                        }
                }
+         // new code:
+               if( this.parent && opts.autoHide ) {
+                 var display = this.bExpanded ? "none" : "";
+                 for (var i=0; i<this.parent.childList.length; i++) {
+                   var child = this.parent.childList[i];
+                   if (child !== this) {
+                     child.li.style.display = display;
+                   }
+                 }
+               }
+         // end
                // If the currently active node is now hidden, deactivate it
                if( opts.activeVisible && this.tree.activeNode && !
this.tree.activeNode.isVisible() ) {
                        this.tree.activeNode.deactivate();
@@ -2996,6 +3007,7 @@
        keyboard: true, // Support keyboard navigation.
        persist: false, // Persist expand-status to a cookie
        autoCollapse: false, // Automatically collapse all siblings, when a
node is expanded.
+        autoHide: true, // Automatically hide all siblings when a
node is expanded
        clickFolderMode: 3, // 1:activate, 2:expand, 3:activate and expand
        activeVisible: true, // Make sure, active nodes are visible
(expanded).
        checkbox: false, // Show checkboxes. 

Original issue reported on code.google.com by rwi...@gmail.com on 6 Sep 2011 at 6:23

GoogleCodeExporter commented 9 years ago
thanks for the patch. I will look into it when I start preparing for 1.3.

Original comment by moo...@wwwendt.de on 6 Sep 2011 at 3:20

GoogleCodeExporter commented 9 years ago
Thank you very much. That functionality is what I was looking for.

Original comment by fvdmagal...@gmail.com on 15 Nov 2012 at 4:20

GoogleCodeExporter commented 9 years ago

Original comment by moo...@wwwendt.de on 10 Feb 2013 at 8:49

GoogleCodeExporter commented 9 years ago

Original comment by moo...@wwwendt.de on 6 Oct 2013 at 3:17

GoogleCodeExporter commented 9 years ago
As of 2014 Dynatree is feature frozen.
Please have a look at Fancytree (sequel of DynaTree 1.x): chances are good that 
the problem was resolved / the requested featuer is already implemented.
Please open a new issue there otherwise:

https://github.com/mar10/fancytree

Original comment by moo...@wwwendt.de on 1 May 2014 at 4:38