admin管理员组文章数量:1289879
I am facing difficulty to bind jstree with an on-expand/on-collapse event. I am currently binding the jstree with selected_node event like this :
$(function () {
$("#tree").jstree({
"json_data" : {
"data" : [
{
data : "/",
attr : { "id" : "root"},
state : "closed",
"children" : [ { "data" : "child1",
"attr" : { "id" : "child1.id" },
"children" : [ ] }
]
},
]
},
"plugins" : [ "themes", "json_data", "crrm", "ui" ]
})
.bind("select_node.jstree",function(event, data) { . . . }
I am now looking for the same event handling functionality within {...} for on-expand/on-collapse event as well. Need help to figure out how can that be done.
I am facing difficulty to bind jstree with an on-expand/on-collapse event. I am currently binding the jstree with selected_node event like this :
$(function () {
$("#tree").jstree({
"json_data" : {
"data" : [
{
data : "/",
attr : { "id" : "root"},
state : "closed",
"children" : [ { "data" : "child1",
"attr" : { "id" : "child1.id" },
"children" : [ ] }
]
},
]
},
"plugins" : [ "themes", "json_data", "crrm", "ui" ]
})
.bind("select_node.jstree",function(event, data) { . . . }
I am now looking for the same event handling functionality within {...} for on-expand/on-collapse event as well. Need help to figure out how can that be done.
Share Improve this question edited Apr 20, 2017 at 7:29 Dani 2,0362 gold badges18 silver badges32 bronze badges asked Sep 18, 2013 at 17:17 RAhulRAhul 1631 gold badge6 silver badges16 bronze badges2 Answers
Reset to default 6.on('open_node.jstree', ....);
and
.on('close_node.jstree', ....);
If you want more information about node (like id):
$("#jstree").on("open_node.jstree", function (e, data) { alert("Open node_id: " + data.node.id); });
$("#jstree").on("close_node.jstree", function (e, data) { alert("Close node_id: " + data.node.id); });
本文标签: javascriptBind with jstree on expand and on collapse eventsStack Overflow
版权声明:本文标题:javascript - Bind with jstree on expand and on collapse events - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741446851a2379252.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论