2011-11-18 42 views

回答

-1

下面是一个例子用法:

jQuery("#jsTree").bind("loaded.jstree", function(event, data) { }).jstree({ 
    "core": {}, 
    "json_data": { 
     // Ajax request to load data 
    }, 
    "themes": { 
     "theme": "classic", 
     "dots": true, 
     "icons": true 
    }, 
    "types": { 
     "types": { 
      "max_children": -2, 
      "max_depth": -2 
     } 
    } 
}); 

您可以使用MAX_DEPTH & MAX_CHILDREN PARAMS限制树

+0

JsTree的类型和搜索插件是无关的。指定类型的“max_depth”与搜索深度之间没有关系。 –

1

要筛选与只搜索树相匹配,使用内置的搜索选项show_only_matches:

$("#MyTree").jstree({ 
     "search" : { "case_insensitive" : true, 
      "show_only_matches" : true 
     }, 
    "plugins" : [ "html_data", "ui", "themeroller","search" ] 
    });