2012-04-09 84 views
2

我创建了一个两状态jstree。由于我需要创建一个两状态树,因此我无法选择相对于节点的任何其他节点。我想要的是,当我点击一个特定节点时,所选节点的所有父节点也应该被检查。jstree检查父节点

请帮助我..

+0

使用.bind(“change_state.jstree”,函数(e,d)事件 – 2012-04-09 08:03:08

回答

2

绑定到一个处理程序和节点对象中过去了,树可以穿越时发现所有的父母。以下示例使用类“jstree-open”,但应用于父级的任何其他类也将工作。

$(node).parents(".jstree-open").each(function(index){ 
    var theParent=$(this); 
    // Apply operation to each parent 
});