jstree 仅在单击不在标签上的复选框时才检查取消选中
jstree to check uncheck only if clicked on checkbox not on label
我已经使用 jsTree 渲染了一个树视图,如何才能 check/uncheck 只有在复选框图标上单击而不是在节点标签上单击时才能节点?
我找到了我自己问题的答案
设置以下属性后,它的行为符合预期。
$('#testTree').jstree({
core: {
data: getData,
check_callback: false
},
checkbox: {
three_state : false,
whole_node : false,//Used to check/uncheck node only if clicked on checkbox icon, and not on the whole node including label
tie_selection : false
},
plugins: ['checkbox']
})
对我有用的只是删除了 jstree 选项位中的 "wholerow":
所以,从
"plugins": ["wholerow", "checkbox"],
至:
"plugins": ["checkbox"],
因此,整个 jstree 配置如下所示:
$('#testTree').jstree({
"core": {
"themes": {
"theme": "default",
"dots": false,
"icons": false
},
"data": @Html.Raw(ViewBag.Menu)
},
"checkbox": {
"keep_selected_style": false,
},
"plugins": ["checkbox"],
});
我已经使用 jsTree 渲染了一个树视图,如何才能 check/uncheck 只有在复选框图标上单击而不是在节点标签上单击时才能节点?
我找到了我自己问题的答案
设置以下属性后,它的行为符合预期。
$('#testTree').jstree({
core: {
data: getData,
check_callback: false
},
checkbox: {
three_state : false,
whole_node : false,//Used to check/uncheck node only if clicked on checkbox icon, and not on the whole node including label
tie_selection : false
},
plugins: ['checkbox']
})
对我有用的只是删除了 jstree 选项位中的 "wholerow":
所以,从
"plugins": ["wholerow", "checkbox"],
至:
"plugins": ["checkbox"],
因此,整个 jstree 配置如下所示:
$('#testTree').jstree({
"core": {
"themes": {
"theme": "default",
"dots": false,
"icons": false
},
"data": @Html.Raw(ViewBag.Menu)
},
"checkbox": {
"keep_selected_style": false,
},
"plugins": ["checkbox"],
});