昨天开始使用jQuery和jsTree插件,并通过对servlet的AJAX调用成功加载树.现在,我想在加载后让树打开所有节点,所以我在ajax属性中添加了一个成功函数.但是,我似乎无法使open_all()方法正常工作.我对使用jQuery非常陌生,所以我猜这很简单,我做错了.
Firebug没有显示任何错误,这些错误排除了输入错误的方法名称的愚蠢错误.我检查了文档,我认为我正在按照我所读的内容正确地完成所有工作.树正确加载,但在页面加载后没有打开所有节点.
我在Firefox 3.6.8上使用jQuery 1.4.2和jsTree 1.0rc2.
这是我用来加载树并尝试打开树中所有节点的代码:
// Create the tree object
$("td#modelXML").jstree({
core : { "animation" : 0 },
//xml_data : {"data" : "" + xml, "xsl" : "nest"},
xml_data : {"ajax" :
{"url" : "servlet/GetModelHierarchy",
"type" : "post", "data" : { modelId : "" + modelId} },
"xsl" : "nest",
"success" : function(){
$(this).open_all(-1);
}
},
themes : {"theme" : "classic", "dots" : true, "icons" : true},
types : {
"types" : {
"category" : {
"valid_children" : …
Run Code Online (Sandbox Code Playgroud)