Opened 12 years ago

Closed 12 years ago

#5912 closed enhancement (duplicate)

[patch][ccla] Allow Tree to use custom TreeNode implementations

Reported by: Robert Coup Owned by:
Priority: high Milestone: 1.2
Component: Dijit Version: 1.0
Keywords: tree Cc: bill
Blocked By: Blocking:

Description

Currently if you want to make your nodes more complicated than adjusting the CSS or text label it requires monkey-patching dijit._TreeNode.

The attached patch adds a nodeType parameter to dijit.Tree which takes a constructor function (or string that can be resolved), which is used for constructing nodes in that tree. A simple test is there as well. The constructor function needs to be compatible with dijit._TreeNode obviously. But it allows easy behavior changes, using different templates, storing more state, etc.

Submitting for review, since I'm not a Tree expert. I'm also not sure about the nodeType name, feel free to offer improvements.

Attachments (2)

tree_custom_nodetype.0.patch (3.2 KB) - added by Robert Coup 12 years ago.
tree_custom_nodetype.1.patch (3.2 KB) - added by Robert Coup 12 years ago.
minor formatting/style improvements

Download all attachments as: .zip

Change History (4)

Changed 12 years ago by Robert Coup

comment:1 Changed 12 years ago by Robert Coup

Cc: bill added

Changed 12 years ago by Robert Coup

minor formatting/style improvements

comment:2 Changed 12 years ago by bill

Resolution: duplicate
Status: newclosed

Heh, I'm never sure what to name things myself either. See #5719 which is a dup of this one.

Note: See TracTickets for help on using tickets.