$("#reversecheckallmachines").on("change", function () {
var checkedNodes = [];
var uncheckedNodes = [];
var nodes = $tree.jstree("get\_json", null, { flat: true });
for (var i = 0; i < nodes.length; i++) {
if (nodes\[i\].state.selected) {
var findNode = nodes.find(x => x.parent === nodes\[i\].id);
if (!findNode) {
checkedNodes.push(nodes\[i\]);
}
}
else {
var fnode = nodes.find(x => x.parent === nodes\[i\].id);
if (!fnode) {
uncheckedNodes.push(nodes\[i\]);
}
}
}
$tree.jstree("uncheck\_node", checkedNodes);
$tree.jstree("check\_node", uncheckedNodes);
});
手机扫一扫
移动阅读更方便
你可能感兴趣的文章