Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
793 views
Welcome To Ask or Share your Answers For Others

1 Answer

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 
                    } 
                }
            }

and the type assigment:

$.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

Hope it helps!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...