jstree 版本 3 确实具有 get_selected 功能,它为您提供所有选中的项目
var selectedElements = $('#treeidhere').jstree("get_selected", true);
// Iterate over all the selected items
$.each(selectedElements, function () {
alert(this.id);
});
Run Code Online (Sandbox Code Playgroud)
对于未确定的节点,
var checked_ids = [];
$("#treeidhere").find(".jstree-undetermined").each(function (i, element) {
alert($(element).closest('.jstree-node').attr("id"));
checked_ids.push($(element).attr("id"));
});
Run Code Online (Sandbox Code Playgroud)