2016-03-07 84 views
0

我試圖把默認值jstree複選框, 文件夾狀態要打開的工作,但選擇的狀態,檢查工作不jstree默認選中狀態不工作

這裏是代碼。

$('#jstree_demo_div').jstree({ 
     "core" : {"data":[{"dataParent":0,"id":30,"text":"Eyewear","state":{opened : true,checked : true},children : [{ "text" : "Child 2", state : { checked : true }}]}], 
      "themes" : { "icons": false } 
    }, 
    "plugins" : [ "checkbox" , "search" ], 
}); 

output

回答

0

只要改變checkedselected如下。檢查演示 - Codepen

{ 
    "data": [{ 
     "dataParent": 0, 
     "id": 30, 
     "text": "Eyewear", 
     "state": { 
      opened: true, 
      selected: true 
     }, 
     children: [{ 
      "text": "Child 2", 
      state: { 
       selected: true 
      } 
     }] 
    }]; 
}