1

how to set_type when loading jstree? I need disable some node after load jstree, and before use it. I defined a new type "disabled", but I dont know how to use it. I have found many solutions and read docs. I still confused. How to set type to the node? why does this not work in my code to call set_type? My source is html_data. can anyone give me some references or advices? thx $("#demo1").jstree({ "checkbox" : {"two_state" : true}, "plugins" : [ "themes", "html_data", "checkbox", "ui" ],

        "types" : {
            "types": {
                "disabled" : { 
                    "check_node" : false, 
                    "uncheck_node" : false,
                    // "select_node" : function () {return false;}
                }
            }
        }

});

$("#demo1").bind("loaded.jstree", function (e, data) {
    $.jstree._reference("#demo1").get_unchecked(0, true).each(function(){
        if($(this).children().length <= 2){
            if("-1" == this.title ) {

                $(this).jstree("set_type", "disabled");
                $.jstree._reference("#demo1").set_type("disabled", "#-1");

            }
        }
     });
Nick Dong
  • 3,638
  • 8
  • 47
  • 84
  • 1
    I know what is wrong. I didnt add "types" plugin. See [https://groups.google.com/forum/#!topic/jstree/wLokkEg3eCY](https://groups.google.com/forum/#!topic/jstree/wLokkEg3eCY) – Nick Dong Aug 16 '13 at 02:45
  • 1
    And there two ways: 1st `$("#demo1").jstree("set_type", "disabled", "#"+this.id);` 2nd `$.jstree._reference("#demo1").set_type("disabled", "#"+this.id);` – Nick Dong Aug 16 '13 at 02:48
  • Q_s: [http://stackoverflow.com/questions/8487305/jstree-disable-checkbox?rq=1](http://stackoverflow.com/questions/8487305/jstree-disable-checkbox?rq=1) || [http://stackoverflow.com/questions/3633834/jstree-set-type](http://stackoverflow.com/questions/3633834/jstree-set-type) || [http://stackoverflow.com/questions/15784999/disable-certain-checkboxes-from-jstree](http://stackoverflow.com/questions/15784999/disable-certain-checkboxes-from-jstree) || [http://stackoverflow.com/questions/14435146/disable-jstree-check-box](http://stackoverflow.com/questions/14435146/disable-jstree-check-box) – Nick Dong Aug 16 '13 at 03:20

0 Answers0