音乐 关注 标签
评论 参与 新评

jstree复选框自定义显示隐藏

jstree 本身不支持在节点中隐藏 checkbox,国外有个大佬给出一个利用 css 来隐藏的解决方案:

首先来一段 css

.no_checkbox>i.jstree-checkbox{display:none}

然后在 data 的 json 数据结构中

$('#demo_tree').jstree({
    "core" : {
        'data': [
           { "id" : "ajson1", "parent" : "#", "text" : "Simple root node", state: {checked: true}},
           { "id" : "ajson2", "parent" : "#", "text" : "Root node 2" },
           { "id" : "ajson3", "parent" : "ajson2", "text" : "Child 1" , a_attr: {class: "no_checkbox"}},
           { "id" : "ajson4", "parent" : "ajson2", "text" : "Child 2" },
        ]
    },
    "plugins" : ['checkbox'],
});

效果:

 

jstree version => 3.3.8

posted on 2020-01-07 16:32  ☠☚㊙☛☠  阅读(262)  评论(0编辑  收藏  举报

Top
打赏

打赏

公众号