Login Register

Trees

The trees we see in User Interfaces help sort out long, heirarchical lists. A file system is the classic example, with Windows using it in Explorer and Macintoshes with Finder (is it still called that???).

Nodes are the basis of a dojo tree. A node can include other nodes, and is then called a branch, container or folder. A node containing no other nodes is a leaf. Dojo does not force you to distinguish branches from leaves. It deduces the tree structure from your own code.

A dojo tree contains at least two dojo widgets:

  • A surrounding Tree widget
  • Embedded TreeNode widgets

But there are many dojo widgets to help you sculpt, mold, and connect behavior to your tree.

missing menu-items

The current "tree" section doesn't appear in the left-hand menu neither in the breadcrumb - just if I click "more on widgets" I'll get it in the overview..

Yup.  We're aware of that,

Yup.  We're aware of that, and it's on the docket to be fixed fairly soon.  Thank you!

Handle Tree DND Drop events?

I have stumbled across a really odd problem and I don't know how to solve it:

I want to handle drop events in a Tree, i.e. perform some checks on a dropped node. Simple, I thought, just connect your drop handler to the drop target's onDrop() function everytime a new node is created:

    onFilterTreeNodeAdded: function(message) {
        // register DND handler for new node
        var id = message.child.widgetId;
        var filterTree = dojo.widget.byId("FilterTree");
        var dndController = filterTree.controller.DNDController;
        var dropTarget = dndController.dropTargets[id];
        dojo.event.connect(dropTarget, "onDrop", this, "onFilterNodeDropped");
        
        // handle change event
        this.onFilterTreeChanged(message);
    }

However that does NOT work. My event handler is never called, but dropTarget.onDrop() is. I noticed that in the debugger the join-point object injected by dojo.event.connect() was not there when onDrop() is called, so my handler wouldn't be called. I realized that this is because onDrop() is called on a COPY of the dropTarget object referenced in dndController.dropTargets which doesn't know a thing about my event handler (I inserted an identity check in the Dojo onDrop() function and it always fails).

This is very inconvenient, I'm sure there must be a way to intercept onDrop() events on Trees?!

Use the forums please...

This should be covered by the documentation

I have opened a thread at http://dojotoolkit.org/forum/dojo-0-4-x-legacy/dojo-0-4-x-support/handle...

Stuff like that should really be covered by the documentation, which means, on this very page.

Yes, but support questions

Yes, but support questions are handled in the support forums, requests append/correct/modify documentation are here, and the reason behind this is to keep these pages from having 3 screens of comments not related to the actual page but to everyone elses "support needs" here.

-Karl