jsTree - 在loaded.jstree 事件中获取选定的节点
如何在loaded.jstree事件中获取选定的节点?
我应该在事件处理程序中做什么:
$('#Tree').bind('loaded.jstree', function(event, data){//TODO: How to get the selected node here?}).jstree();
顺便说一句,我发现事件数据arg对象包含一个名为get_selected()的函数,但无法从中获取任何内容。
我的目的是将客户端重定向到当前选定的节点(通过“url”属性)。
提前致谢
How can I get the selected node on the loaded.jstree event?
what should I do in the event handler:
$('#Tree').bind('loaded.jstree', function(event, data){//TODO: How to get the selected node here?}).jstree();
By the way, I found out that the event data arg object contains a function called get_selected() but couldn't get anything from it.
My purpose is to redirect the client to the current selected node (by 'url' attribute).
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
似乎根据此处演示的文档:
http://www.jstree.com/demo
你可以执行以下操作:
或
仔细阅读文档:
,如果您不使用 UI 插件,则可以正确地进行重定向,而不是编写
event.preventDefault();
,并编写:window.location = $(this).attr('href');
Seems according to the documentation of the demo here :
http://www.jstree.com/demo
you can do :
or
Read carefully the documentation as :
For the last event
delegate
, instead of writingevent.preventDefault();
, you can make your redirection correctly if you're not using the UI plugin, and write :window.location = $(this).attr('href');
您可以通过以下方式选择当前节点:
代码变为:
you can select current node by :
Code becomes: