var OpenRecurs = function($t, $c) {
var $p = $t.jstree("_get_parent", $c)
if ($p.attr("id") != $c.attr("id")) {
OpenRecurs($t, $p)
}
$t.jstree("open_node", $c)
}
var SelectInTree = function($t) {
var $n = $(sel)
OpenRecurs($t, $n)
$t.jstree("deselect_all")
$t.jstree("select_node", $n)
}
SelectInTree($("#pkgbrowser"))
Here sel is the selector used for the child node. It is selecting the node successfully, but it is not opening the parents. $p ends up being the div containing the jstree as a whole.
Any pointers?
Also, is there a way I could do something like $t.select_node($n) instead of $t.jstree("select_node", $n)?
- John
Selecting a node will automatically open it's ancestors.
$.jstree._reference('#treeID').select_node('#nodeID');