jstree 默认检查状态不起作用
jstree default checked state not working
我正在尝试为 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" ],
});
只需将 checked
更改为 selected
,如下所示。检查演示 - Codepen.
{
"data": [{
"dataParent": 0,
"id": 30,
"text": "Eyewear",
"state": {
opened: true,
selected: true
},
children: [{
"text": "Child 2",
state: {
selected: true
}
}]
}];
}
我正在尝试为 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" ],
});
只需将 checked
更改为 selected
,如下所示。检查演示 - Codepen.
{
"data": [{
"dataParent": 0,
"id": 30,
"text": "Eyewear",
"state": {
opened: true,
selected: true
},
children: [{
"text": "Child 2",
state: {
selected: true
}
}]
}];
}