I have a jstree with checkbox for every nodes. I want to achieve the following. Let me know which method or part of api helps us to do that.
I searched API docs but found nothing.
Take a look at the real_checkboxes options. This might get you started:
$("#jstree").jstree({
"checkbox": {
real_checkboxes: true,
real_checkboxes_names: function (n) {
var nid = 0;
$(n).each(function (data) {
nid = $(this).attr("nodeid");
});
return (["check_" + nid, nid]);
},
two_state: true
},
"plugins": ["themes", "json_data", "ui", "checkbox"]
})
.bind('open_node.jstree', function (e, data) {
$('#jstree').jstree('check_node', 'li[selected=selected]');
})
You'll probably need to change the bind behaviour so that it checks the parent when a child is checked.