jstree默认检查状态不起作用

时间:2016-03-07 14:53:39

标签: 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

1 个答案:

答案 0 :(得分:0)

只需将checked更改为selected,如下所示。查看演示 - Codepen

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