jsTree打开一个分支 [英] jsTree Open a branch

查看:100
本文介绍了jsTree打开一个分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JQuery插件jsTree, http://www.jstree.com/ 我可以使用以下方法扩展整个树:

I am using the JQuery plugin jsTree, http://www.jstree.com/ I am able to expand the whole tree with the following method:

$("#tree").jstree("open_all");

,还有一个特定的节点:

and also a specific node:

$("#tree").jstree("open_node", $('#childNode'));

我在打开树的分支时遇到困难,打开分支可以很好地打开它,但是如果有它的父树则不会打开它的父.

I am having difficulty opening a branch of the tree, open branch opens it fine but does not open its parent if it has one.

有人用jsTree成功做到了吗?让我知道您是否需要更多信息.

Has anyone successully done this with jsTree? Let me know if you need more info.

谢谢

Eef

推荐答案

您可以使用绑定

$("#tree").bind("open_node.jstree", function (event, data) { 
  if((data.inst._get_parent(data.rslt.obj)).length) { 
    data.inst._get_parent(data.rslt.obj).open_node(this, false); 
  } 
}); 

这篇关于jsTree打开一个分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆