You can use any uncheck code inside the
.bind("loaded.jstree",function(e,data){
//your jquery code for check and uncheck.
});
this will call the required action when the tree gets loaded.
If you encounter problems let me know.
Question
I am using jtree plugin in my application. I want to disable all checkboxes in jstree in edit mode. The checkbox is programmaticly checked after load jstree. my only thing is want to disable all checkboxes.
$("#testId").jstree({
"json_data" : {
"data" : rootNode,
"progressive_render" : true,
"progressive_unload" : true
},
"checkbox" : {
"two_state" : true
},
"themes" : {
"theme" : "apple",
"dots" : false,
"icons" : false
},
"plugins" : [ "themes", "json_data", "ui", "checkbox"]
});
Solution 2
You can use any uncheck code inside the
.bind("loaded.jstree",function(e,data){
//your jquery code for check and uncheck.
});
this will call the required action when the tree gets loaded.
If you encounter problems let me know.
OTHER TIPS
One more thing that might work for you would be,
You can programmaticly check and uncheck the required checkboxes based on the json data or javascript in the
.bind("loaded.jstree",function(e,data){
//your jquery code for check and uncheck.
});
later to disable checking and unchecking the jstree checkbox you can do the following:
.bind("check_node.jstree",function(e,data){
return false;
});
.bind("uncheck_node.jstree",function(e,data){
return false;
});
This will disallow user from changing the status of the checkbox.
I discovered this while experimenting!!!
Demo FIDDLE
Jquery
$('.check').eq(4).prop('checked',true); //checkbox checked
if($('.check:checked').length>0)
$('.check').attr('disabled','disabled');
$('.check1').eq(3).prop('checked',true); //checkbox checked
if($('.check1:checked').length>0)
$('.check1').not($('.check1').eq(4)).attr('disabled','disabled');
As per your condition you will change the class