有一个带有复选框的jsTree,如何禁用所有复选框? [英] Having a jsTree with checkboxes, how can i disable all checkboxes?

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

问题描述

我有一个动态构建的jsTree,允许用户选择他选择的任何节点。

I have a jsTree, built dynamically, that allows the user to select whatever nodes he chooses.

现在我正在努力使这棵树只读,以便其他用户可以在不改变信息的情况下查看信息。

Now i'm trying to make this tree readonly so that other users can see the information without altering it.

我找到的所有示例都是关于禁用特定节点......

All examples i find are about disabling a specific node...

我的问题是:有没有办法将树上的所有复选框定义为只读?

My question is: Is there a way to define all the checkboxes on the tree to readonly?

正在使用的代码:

jQuery.noConflict();
jQuery(
    function() {
        jQuery("#divTree").jstree(
            {
                "plugins": ["themes", "json_data", "checkbox", "sort", "ui", "real_checkboxes"],
                json_data: { data: data }
            }
        );
    }
);


推荐答案

问题已解决。以下是需要它的任何人的解决方案。

Problem Solved. Here is the solution for anyone that needs it.

jQuery.noConflict();
jQuery(
    function() {
        jQuery("#divTree")
        <% if(isReadOnly) { %>
        .bind("loaded.jstree", function (event, data) 
             {
            jQuery('.jstree a').click(function() {return false;});
        })
        <% } %>
       .jstree(
                {
                    "plugins": ["themes", "json_data", "checkbox", "sort", "ui", "real_checkboxes"],
                    json_data: { data: data }
                }
            );
        }
    );

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

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