Opened 15 years ago
Closed 15 years ago
#4553 closed enhancement (fixed)
Tree: option where clicking label shows children
Reported by: | guest | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.1 |
Component: | Dijit | Version: | 0.9 |
Keywords: | Tree TreeNode expand | Cc: | |
Blocked By: | Blocking: |
Description
Posted at bill's request after http://dojotoolkit.org/forum/dijit-dijit-0-9/dijit-development-discussion/treenode-expand-method-doesnt-first-populate-chil
A Tree that displays hierarchical data should be able to function like Windows Explorer's folder pane where clicking on a parent opens up the children below (rather than forcing a click on the expando).
Under 0.9, I was able to construct a workaround by copying the code from the prototype's expando code however I would have preferred to just call node.expand().
<div id="myTree" dojoType="dijit.Tree" store="myStore" labelAttr="label" childrenAttr="children"> <script type="dojo/method" event="onClick" args="item,node"> if( myList.getValue(item,"type") == "leaf") { /* my custom action */ handleChildClick( myList.getValue(item, "childID")); } else if( node.isExpanded) { /* this works fine */ node.collapse(); } else { /* this doesn't work because the children aren't there yet */ // node.expand(); /* this works because it is copied from the expando's _onClick handler */ dijit.byId("myTree")._publish("toggleOpen", {node:node}); } </script> </div>
Ideally this behavior could be built into the Tree control itself and toggled on or off by declaration.
Change History (3)
comment:1 Changed 15 years ago by
Summary: | Tree: TreeNode.expand does not first populate children → Tree: option where clicking label shows children |
---|
comment:2 Changed 15 years ago by
Owner: | set to bill |
---|
comment:3 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks. If this option is set to true then should the user's onClick function still be called (on non-leaf nodes)?