gpt4 book ai didi

javascript - 如何加载带有关闭检查节点的jstree?

转载 作者:行者123 更新时间:2023-12-03 08:26:08 30 4
gpt4 key购买 nike

我设置选择:true

$('#tree3').jstree({ 'core' : {
'data' : [
{ "id" : "ajson2", "parent" : "#", "text" : "Root node" , state : {opened : false}},
{ "id" : "ajson5", "parent" : "ajson2", "text" : "Child 3" , state : {opened : false, selected: true}, icon: false},
{ "id" : "ajson4", "parent" : "ajson2", "text" : "Child 2" , state : {opened : false, selected: true}, icon: false}
]
},
"checkbox" : {
"keep_selected_style" : false
},
"plugins" : [ "checkbox" ]
});

IMAGE: I get bad result

为什么我的节点被打开了?

如果我尝试 selected: false 我会关闭节点,但不会检查。

jsTree - v3.2.1 及更早版本

最佳答案

默认情况下,所有节点均未打开,但在启动时显示。使用如下的 Expand_selected_onload ,您应该能够在未打开的状态下加载树:

$('#tree3').jstree({ 'core' : {
'data' : [
{ "id" : "ajson2", "parent" : "#", "text" : "Root node" , state : {opened : false}},
{ "id" : "ajson5", "parent" : "ajson2", "text" : "Child 3" , state : {opened : false, selected: true}, icon: false},
{ "id" : "ajson4", "parent" : "ajson2", "text" : "Child 2" , state : {opened : false, selected: true}, icon: false}
],
expand_selected_onload : false
},
"checkbox" : {
"keep_selected_style" : false
},
"plugins" : [ "checkbox" ]
});

关于javascript - 如何加载带有关闭检查节点的jstree?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33541636/

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