Tuesday, October 25, 2011

Dojo Tree's

I am working with Dojo Tree's at work.  Some interesting notes:

If you want to highlight the selectedNode in the tree use: .dijitTreeRowSelected.
You can set the selectedNode to null when there is a click in the root area of the tree like this:
    if(className.indexOf('dijitTreeContainer') !== -1) {
      this._objTree.set('selectedItem', null);
    }
Also you might want to expand the selected node if you are creating a new node as a child of it:
    if(this._objTree.selectedItem) {
      this._objTree._expandNode( this._objTree.getNodeFromItem(this._objTree.selectedItem)[0] );
    }