Opened 12 years ago

Closed 10 years ago

Last modified 10 years ago

#5062 closed enhancement (fixed)

Tree: method to fully expand a tree (expand all nodes in the tree recursively)

Reported by: jgarfield Owned by: bill
Priority: high Milestone: 1.4
Component: Dijit Version: 1.0
Keywords: dijit, tree, dijit.Tree Cc:
Blocked By: Blocking:

Description (last modified by bill)

I've been seeing a lot of questions in regards to 'dynamically or auto expanding a Tree'. You can do such using a forEach on the TreeNodes? and calling _expandNode(), however, that's marked as a private method, which makes this practice not-so-good.

Should we add a public property or function to allow for this?

Example property would be something like autoExpand="true"

Example function would be something like expandNode: function(node) { }

Any takers?

Attachments (1)

dijit.Tree.expandChildren.patch (508 bytes) - added by guest 12 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 12 years ago by bill

I'm not sure what you mean. If there's an expandNode() method than that's for programatically expanding a tree node. What do you mean by "auto-expand"? And what would the autoExpand="true" property do? Expand every node in the tree?

comment:2 Changed 12 years ago by bill

Milestone: 1.12.0

comment:3 Changed 12 years ago by alex

Milestone: 2.01.3

Milestone 2.0 deleted

Changed 12 years ago by guest

comment:4 Changed 12 years ago by guest

Find attached a patch to dijit.Tree that exposes an expandChildren() method. It will expand a node and all of its children.

Example: var myTree = new dijit.Tree(...); myTree.expandChildren();

comment:5 Changed 12 years ago by Neil Roberts

(In [12628]) Refs #5062.

  • Update parser to handle: foo = dojo.extend(function(){}, {bar: "baz"});
  • Pass and flag private variables

comment:6 Changed 12 years ago by bill

Owner: set to bill
Summary: dijit.Tree Auto-Expand functionalityTree: method to fully expand a node (and all it's descendants)

(Above check in comment was actually for another ticket, put here by mistake.)

Not sure if this method is worth putting into Tree; I am trying to keep the API surface small.

BTW I don't think that patch works in the general case because it doesn't account for async-loading of tree nodes.

comment:7 Changed 11 years ago by bill

Description: modified (diff)
Milestone: 1.3future

comment:8 Changed 10 years ago by bill

Summary: Tree: method to fully expand a node (and all it's descendants)Tree: method to fully expand a tree (expand all nodes in the tree recursively)

comment:9 Changed 10 years ago by alle

In addition to async-loading of tree nodes patch limit I think that "expand all" concept fail flat when tree is infinite deep because of an item being a descendant of self.

comment:10 Changed 10 years ago by bill

Milestone: future1.4
Status: newassigned

comment:11 Changed 10 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [20514]) Tree: expandAll() method. Tests to follow. Fixes #5062 !strict.

comment:12 Changed 10 years ago by bill

(In [20529]) Replace expandAll() method with autoExpand=true flag specified on initialization. Could have an expandAll() method too (and I guess collapseAll() method) but I'm not sure there's a need; seems like something developers would just want to do when a Tree is first displayed. Refs #5062 !strict.

Note: See TracTickets for help on using tickets.