var treeData = [
{
title : "Root Node", folder : true, key : "id1",
children : [
{ title : "Sub-item 1.1", key : "id1.1" },
{
title : "Sub-item 1.2", folder : true, key: "id1.2",
children : [
{ title : "Sub-item 1.2.1", key : "id1.2.1" },
{ title : "Sub-item 1.2.2", key : "id1.2.2" },
{
title : "Sub-item 1.3.1", folder : true, key : "id1.3.1",
children : [
{ title : "Sub-item 1.3.1", key : "id1.3.1" },
{ title : "Sub-item 1.3.2", key : "id1.3.2", active : true, selected: true },
{ title : "Sub-item 1.3.3", key : "id1.3.3" }
]
}
]
}
]
}
];
The forth level "Sub-item 1.3.2" has attribute 'avtive' and 'selected',
is there any way to expand it's ancestor node by giving a parameter to the $.fn.fancytree({ ... }) method, or just find ancestor node and set the 'expanded' attribute to 'true'?
init: function(event, data) { var activeJumpNode = data.tree.getActiveNode(); if ( activeJumpNode ) { var treeObj = $("YourSelector").fancytree("getTree"); var jumpToNode = treeObj.findFirst(function(node) { return node === activeJumpNode; }); jumpToNode.setActive(); jumpToNode.setFocus(); $(treeObj.$container).focus(); } }