简体   繁体   English

jsTree禁用复选框不起作用

[英]jsTree disable checkbox not working

I am using jsTree latest version in one of my application. 我在我的一个应用程序中使用的是jsTree最新版本。 I want certain checkboxes to be disabled by default. 我希望默认情况下禁用某些复选框。 For that i am referring this . 为此,我指的是这个

I have following jstree code: 我有以下jstree代码:

$("#"+"div_"+aspectid).jstree({ 
                    'core' : {
                        "themes" : { "icons" : false },
                        'data' : {
                            'url' : 'include/ajax.php?option=constructtree',
                            'data' : function (node) {
                                return { aspectcode : aspectcode, geographylevel : geographylevel }; 
                                } 
                            }
                        },
                       "types" : 
                    {
                        "types" : {
                            "disabled" : {
                                 "check_node" : false, 
                                 "uncheck_node" : false 
                            }
                        }
                    },
        "plugins" : ["themes","html_data","ui","crrm","types", "checkbox"],
                    "checkbox" : { "two_state" : true }
                    });

I have added rel=disabled in the li tags 我在li标签中添加了rel = disabled

<li id=$childvalue[code] rel='disabled'>

I am not getting any errors and i am able to check and uncheck the node. 我没有收到任何错误,并且能够检查和取消选中该节点。

What could be the issue? 可能是什么问题?

provide filddler for same. 提供相同的过滤器。

Inorder to disable check box and make it not to check and uncheck use "onclick= return false" 为了禁用复选框并使其不被选中和取消选中,请使用“ onclick = return false”

This functionality has been changed in more recent versions of jstree. 此功能已在最新版本的jstree中进行了更改。

With 3.2, to disable a checkbox set the data-jstree attribute on the LI tag. 在3.2中,要禁用复选框,请在LI标签上设置data-jstree属性。

<li data-jstree={ "checkbox_disabled": true }>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM