jstree 禁用复选框 [英] jstree disable checkbox

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

问题描述

我目前正在使用 JS Tree 插件和相关复选框插件处理一些 POC.对于某些节点,我需要默认选中复选框并禁用任何进一步的选择.我找到了隐藏复选框的功能

I am currently working on some POC using JS Tree plugin and related check box plugin. For certain nodes I need to check the check box by default and disable any further selection.I found the function to hide the check box

.bind("load_node.jstree", function (e, data) {
          $(this).find('li[rel!=file]').find('.jstree-checkbox:first').hide();
      });

我想找到一种方法来禁用某些节点的复选框,而不是完全隐藏复选框

instead of hiding the check box completely I want to find a way to disable check box for certain nodes

推荐答案

您需要定义一个禁用"类型(使用类型插件),然后将该类型分配给所需的节点.

You will need to define a "disabled" type (using the types plugin) and then assign that type to the desired node.

以这个禁用"的类型定义为例:

Take for instance this "disabled" type definition:

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

和类型分配:

$.jstree._reference('#tree').set_type("disabled", "#node5");

可以在此处找到有关类型插件的更多信息,您也可以查看这个谷歌群组有更多关于禁用复选框的信息

More info on the types plugin can be found here and you can also check this google group with more info on disabling checkboxes

希望能帮到你!

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

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