禁用JSTREE复选框 [英] Disable JSTREE check box

查看:291
本文介绍了禁用JSTREE复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道JSTREE中是否有任何禁用复选框的方法?

Just curious to know if there is any way in JSTREE to disable checkbox?

当我单击父节点时,基本上我需要禁用(而不是取消选择)所有选定的子节点.

I basically need to disable(not deselect) all my selected child nodes when I click on the parent node.

推荐答案

您需要为此创建一个新类型(禁用).可以做到如下

You need to create a new type(disabled) for this. It can be done as follows

   "types" : {
        "types": {
        "disabled" : { 
              "check_node" : false, 
              "uncheck_node" : false 
            } 
        }
    }

,然后将该类型分配为

.set_type("disabled", "#node5");

更多文档在这里.

要禁用所有子节点,请为change_state事件创建一个事件处理程序

For disabling all child nodes, create an event handler for the change_state event

$("#treeElement").bind("change_state.jstree", function (e, d) {
    var node = d.args[0];
    // here disable all child nodes
    }
});

这篇关于禁用JSTREE复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆