现在项目中需要用到目录,于是找了个js树插件jstree
摸索了一段时间,分享一下
异步调用:
$("#jstree_div").jstree({
'core': {
'animation': 0
, 'data': {
'async': true
, 'url': 请求路劲
}
}, "plugins": ["core", "html_data"]
}).on("click.jstree", function(){
//自定义方法
});
默认展开所有节点:
之前找了很多资料发现都是说用
.bind("loaded.jstree", function (e, data) {
data.inst.open_all(-1); // -1 opens all nodes in the container
}
我加了之后没效果,终于发现另一种方式
$("#jstree_div").jstree();
$("#jstree_div").jstree("open_all");
两个一起用
最全的前端资源导航:http://www.iwan0.com/
里面还有时常更新的冷笑话哟
最全的前端资源导航:http://www.iwan0.com/
里面还有时常更新的冷笑话哟