我使用jstree('get_selected',false)获取具有复选框插件的jstree的选定节点,但结果不包括状态不确定的节点。我如何才能使所有选定节点包括未确定的节点。
最新版本的jstree不包含方法“ get_checked”,为什么?
谢谢。
jstree版本3确实具有get_selected功能,它为您提供了所有选中的项目
var selectedElements = $('#treeidhere').jstree("get_selected", true);
// Iterate over all the selected items
$.each(selectedElements, function () {
alert(this.id);
});
对于不确定的节点,
var checked_ids = [];
$("#treeidhere").find(".jstree-undetermined").each(function (i, element) {
alert($(element).closest('.jstree-node').attr("id"));
checked_ids.push($(element).attr("id"));
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句