我正在尝试为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" ],
});
答案 0 :(得分:0)
只需将checked
更改为selected
,如下所示。查看演示 - Codepen。
{
"data": [{
"dataParent": 0,
"id": 30,
"text": "Eyewear",
"state": {
opened: true,
selected: true
},
children: [{
"text": "Child 2",
state: {
selected: true
}
}]
}];
}