Ticket #5912 (closed enhancement: duplicate)

Opened 6 months ago

Last modified 6 months ago

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

Reported by: rcoup Owned by:
Priority: normal Milestone: 1.2
Component: Dijit Version: 1.0
Severity: normal Keywords: tree
Cc: bill

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

tree_custom_nodetype.0.patch (3.2 kB) - added by rcoup 6 months ago.
tree_custom_nodetype.1.patch (3.2 kB) - added by rcoup 6 months ago.
minor formatting/style improvements

Change History

Changed 6 months ago by rcoup

Changed 6 months ago by rcoup

  • cc bill added

Changed 6 months ago by rcoup

minor formatting/style improvements

Changed 6 months ago by bill

  • status changed from new to closed
  • resolution set to duplicate

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.