I am using jstree with checkbox.
I have another checkbox with Id chkSelectAll (Select All). When user select it, All jstree checkboxes are checked and if we unselect it, all jstree checkboex are unchecked using below code:
$('#chkSelectAll').change(function() {
if ($('#chkSelectAll').is(":checked"))
{
$("#drpDownSource .source-list").jstree().check_all(true);
}
else
{
$("#drpDownSource .source-list").jstree().uncheck_all(true);
}
});
Now if all jstree checkboxes are selected manually then I want to check chkSelectAll checkbox and if any one jstree checkbox is unchecked then I want chkSelectAll to be unchecked. I am using below code:
So How can I know whether all jstree checkbox are checked or not?
.on("check_node.jstree uncheck_node.jstree", function (e, data) {
debugger;
if (e.type == "uncheck_node") {
$("#chkSelectAll").prop( "checked", false );
}
else if (e.type == "check_node") {
// here I get only one checkbox's status.
// How to check all checkboxe's status
}
});
Thanks
Aucun commentaire:
Enregistrer un commentaire