Reputation: 481
I use the jstree('get_selected',false) to get the selected node of my jstree with checkbox plugins, but the result doesn't include the node with undetermined state . How can I get all of the selected node include undetermined ones.
the newest version of jstree does not include the method 'get_checked', why?
thanks.
Upvotes: 1
Views: 4588
Reputation: 868
jstree version 3 does have get_selected feature and it gives you all checked items
var selectedElements = $('#treeidhere').jstree("get_selected", true);
// Iterate over all the selected items
$.each(selectedElements, function () {
alert(this.id);
});
for undetermined nodes,
var checked_ids = [];
$("#treeidhere").find(".jstree-undetermined").each(function (i, element) {
alert($(element).closest('.jstree-node').attr("id"));
checked_ids.push($(element).attr("id"));
});
Upvotes: 6