2

我正在使用带有复选框的 jsTree,它会在选择子节点时检查所有父节点。

有没有办法单独选择每个节点而不管层次结构如何?

目前:

在此处输入图像描述

期望:

在此处输入图像描述

这是我的代码:

$(function () {
 $('#tree').jstree({
  "checkbox": {
   "two_state": true,
   "real_checkboxes": true,
   //this is supposed to fix it but it doesn't
   "override_ui": true
  },
  "plugins": ["themes", "ui", "checkbox"]
 });
 $('#tree').jstree("hide_icons");
 $('#tree').jstree("hide_dots");   
});

是文档。

4

2 回答 2

4

对于GitHub中的当前主版本(2.0.0 alpha),

$(function () {
    $('#demo1').jstree({
        "checkbox": {
            "three_state": false
        },
        "core": {
            "themes": {
                dots: false,
                icons: false
            }
        },
        "plugins": ["html_data", "themes", "ui", "checkbox"]
    });
});

希望这可以帮助。

于 2013-06-05T07:08:23.157 回答
0

使用 3.3.8 版本的 jsTree,是的,而不是使用two_state:true,"three_state": false在复选框插件中使用。@shakib 就在上面。有关完整且有效的源代码,您可以参考https://everyething.com/Example-of-jsTree-to-get-all-checked-nodes#GetAllCheckedNodeWithTriStateDisabled

于 2019-11-03T14:29:13.520 回答