[英]Collapse tree after checking all nodes with jsTree
我正在使用 jsTree 來顯示一棵樹。 我想選擇樹中可以使用的所有節點$("#my-tree").jstree("check_all")
。 這工作正常。
但是,這將擴展所有節點,並且擁有一棵大樹會將其余內容一直向下推。
我想在檢查所有節點后折疊樹,但在檢查所有節點后使用$("#my-tree").jstree("close_all")
不起作用。
任何人都有解決方案?
$("#my-tree").jstree({
"checkbox": {
"keep_selected_style": false
},
"plugins": ["checkbox"]});
$("#my-tree").jstree("hide_dots");
$("#my-tree").jstree("check_all");
$("#my-tree").jstree("close_all");
你可以使用 ready.jstree 事件應該使用這樣的:
var jstreeid = $('#jstree_counties');
jstreeid.jstree({'plugins':["wholerow","checkbox"], 'core' : {
'data' : {
"url" : "json url",
"dataType" : "json"
}
}
}).on('ready.jstree', function () {
jstreeid.jstree("close_all");
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.