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");
}
}
});
$("#demo1").jstree("set_type", "disabled", "#"+this.id);
2nd$.jstree._reference("#demo1").set_type("disabled", "#"+this.id);