我在这里坚持使用jsTree。到目前为止,它可以工作,我可以使用 [+] 图标浏览和展开节点,并在单击节点时打开页面,但我仍然希望它在有人单击节点时展开所有直接节点。
我环顾四周至少 2 小时,但找不到任何东西。官方网站不是很有帮助,因为他们没有足够的例子,而且文档也不是很好。看看这个,但对我也不起作用:http: //luban.danse.us/jazzclub/javascripts/jquery/jsTree/reference/_examples/2_operations.html
我什至没有在萤火虫中收到错误消息
所以这就是我的代码现在的样子,树初始化:
$(function () {
$("#jstree").jstree({
....
点击节点触发的函数
.delegate("a","click", function (e) {
//click on node
var page_id = $(this).parent().attr("page_id");
var idn = $(this).parent().attr("id").split("_")[1];
/*
dosnt seem to work either...
$(this).jstree("openNode", $("#node_"+idn));
$(this).jstree("openNode", "#node_"+idn);
*/
page = "index.php?page_id="+page_id;
//location.href = page;
})
.bind 也不起作用:
$(this).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);
}
})
有没有人看到我在这里错过了什么......?