我在这里遇到了jsTree.到目前为止,它可以工作,我可以使用[+]图标浏览和扩展节点,并在单击节点时打开页面,但我还是希望它在有人点击某个节点时展开所有直接节点.
我看了看周围至少2个小时但是找不到任何东西.官方网站不是很有帮助,因为他们没有足够的例子,而且没有很好的记录.看看这个,但对我来说也不起作用:http: //luban.danse.us/jazzclub/javascripts/jquery/jsTree/reference/_examples/2_operations.html
我甚至没有在firebug中收到错误消息
所以这是我的代码现在的样子,树初始化:
$(function () {
$("#jstree").jstree({
....
Run Code Online (Sandbox Code Playgroud)
单击节点触发的功能
.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;
})
Run Code Online (Sandbox Code Playgroud)
.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);
}
})
Run Code Online (Sandbox Code Playgroud)
有谁看到我在这里失踪了......?