| Issue 416: | [patch] Recursive load path based on any attribute | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Dynatree is very impressive. It's simple to use yet very powerful. Though there was one thing I couldn’t do with Dynatree: lazy load and select a node based on an attribute other than ‘key’. There’s a method loadKeyPath that does the trick for the attribute ‘key’. I’ve added a method that provides the same functionality but for any other attribute available.
I noticed that it’s also only possible to get the key-based path for a node. So I added an additional method to get the path based on a custom attribute.
New methods:
* loadPath(attr, path, callback, pathSeparator)
* getPath(attribute, excludeSelf, pathSeparator)
The ‘old’ method loadKeyPath and getKeyPath are replaced with an implementation of the new methods:
loadKeyPath: function(keyPath, callback) {
return this.loadPath("key", keyPath, callback);
}
getKeyPath: function(excludeSelf) {
return this.getPath("key", excludeSelf, this.tree.options.pathSeparator);
}
I’ve added an extra ‘pathSeparator’ argument to provide extra flexibility. I renamed options.keyPathSeparator to options.pathSeparator to give it a more meaningful name as it is now used as the fall-back separator if none is given as argument.
Note that if an attribute is not unique for a child, the first child with that attribute is loaded.
Please refer to the attached patch for details on the modifications. I hope that this patch can be of use for other developers and maybe can be a good attributions for a next release.
Apr 9, 2013
Project Member
#1
moo...@wwwendt.de
Labels:
Milestone-Release1.3
Oct 6, 2013
(No comment was entered for this change.)
Labels:
-Milestone-Release1.3 Milestone-Release2.0
May 1, 2014
As of 2014 Dynatree is feature frozen. Please have a look at Fancytree (sequel of DynaTree 1.x): chances are good that the problem was resolved / the requested featuer is already implemented. Please open a new issue there otherwise: https://github.com/mar10/fancytree
Status:
WontFix
|