[英]Json to Jstree - Selected Node issue
我建立了一個看起來像這樣的Json:
[{“ data”:{“ title”:“ Part A”,“ attr”:{“ id”:“ II”,“ title”:“ Products”}},“ state”:“ closed”,“ children” :[{“ data”:{“ title”:“ Part AA”,“ attr”:{“ id”:“ 12”,“ title”:“ Chapter22”}},“ state”:“已關閉”,“兒童“:[{” data“:{” title“:”第二章“,” attr“:{” id“:” 25“,” title“:” Apples-“}}},” state“:” selected “, “ children”:[{“ data”:{“ title”:“ Oranges”,“ attr”:{“ id”:“ 28”,“ title”:“ Red”}},“ metadata”:{“ id” :“ 132”,“ description”:“ MyApples”,“ fullClassification”:“ Des”}}],“元數據”:{“ id”:“ 155”,“ description”:“玩具-”,“ fullClassification”: “” Des2“}}],”元數據“:{” id“:” 12333“,”描述“:” Des5“,” fullClassification“:” 0800000000“}}],”元數據“:{” id“:” 243 “,” description“:” Des34“,” fullClassification“:” Des324“}}]
我將此Json轉移到Jstree :(這是處理選擇的ui插件)
$("#jstree01").jstree({
"plugins": ["themes", "ui"],
"themes": {
"theme": "default-rtl",
"dots": false,
"icons": false
},
"ui": {
"select_limit": 1,
"selected_parent_close": false,
"select_prev_on_delete": false,
},
結果:我有一棵有效的樹,但是沒有選擇任何節點。 如何通過Json選擇轉移到Jstree的節點?
http://www.jstree.com/docs/json/
嗨,您必須以這種方式設置state參數:
state: {
opened : boolean // is the node open
disabled : boolean // is the node disabled
selected : boolean // is the node selected
},
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.