我在检索 jstree 中选定节点的状态时遇到了困难(使用 JSON 数据)。这是我尝试实现的方式:
$(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) { . . . }
根据我的研究,我发现data.rslt.obj.attr("state")
应该返回state("open" or "closed")
但它返回未定义。你能帮我确定我在这里缺少什么吗?