Ticket #5912 (closed enhancement: duplicate)
[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.