gpt4 book ai didi

javascript - JSTree - 禁用加载时自动选择子项

转载 作者:行者123 更新时间:2023-11-30 10:12:57 24 4
gpt4 key购买 nike

我需要在加载时禁用所有子项的自动选择。如果我将带有 selected 参数的父节点设置为 true,它将选择它的所有子节点,但我只想选择父节点。

$('#tree_groups').jstree({
'plugins': ["wholerow", "checkbox", "types"],
'core': {
'data': [{
"id": "0-14089749041",
"text": "Sport",
"state": {
"selected": true,
},
"children": [{
"id": "14089749041-14089751330",
"text": "Pallacanestro",},
{"id": "14089749041-14089751110",
"text": "Tennis",},
]},
"types" : {
"default" : {
"icon" : "fa fa-group icon-state-warning icon-lg"
},
"file" : {
"icon" : "fa fa-file icon-state-warning icon-lg"
}
}
});

谢谢

最佳答案

我自己找到了答案,我刚刚设置了three_state复选框插件设置为 false。

$('#tree_groups').jstree({
'plugins': ["wholerow", "checkbox", "types"],
'core': {
'data': [{
"id": "0-14089749041",
"text": "Sport",
"state": {
"selected": true,
},
"children": [{
"id": "14089749041-14089751330",
"text": "Pallacanestro",},
{"id": "14089749041-14089751110",
"text": "Tennis",},
]},
"checkbox" : {
"three_state" : false,
},
"types" : {
"default" : {
"icon" : "fa fa-group icon-state-warning icon-lg"
},
"file" : {
"icon" : "fa fa-file icon-state-warning icon-lg"
}
}
});

关于javascript - JSTree - 禁用加载时自动选择子项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25509501/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com