如何在检查位于同一顶层的一个节点后取消选中所有其他节点?
我成功了一次,但不知何故丢失了原始代码,因为我不是 jstree 方面的专家,所以非常感谢您的帮助,以下是我的尝试:
.on("select_node.jstree", (e, data) => {
const node = data.instance.get_node(data.node, true);
if (!node) {
return;
}
if (node[0].ariaLevel == "1" && node[0].ariaSelected == "true") {
const siblings = node.siblings;
if (siblings.length > 0)
siblings(".selected").each(function () {
data.instance.check_node(this, 0);
});
}
})
运行正常,直到我尝试循环兄弟姐妹并取消选中时,任何人都可以帮助我解决下面的代码: 兄弟姐妹(".selected").each(function () { data.instance.check_node(this, 0); });
I did once successfully but somehow lost original code, since I'm not expert in jstree so your help is very much appreciated, below is my attempt:
.on("select_node.jstree", (e, data) => {
const node = data.instance.get_node(data.node, true);
if (!node) {
return;
}
if (node[0].ariaLevel == "1" && node[0].ariaSelected == "true") {
const siblings = node.siblings;
if (siblings.length > 0)
siblings(".selected").each(function () {
data.instance.check_node(this, 0);
});
}
})
runs OK until when i try to loop siblings and uncheck, can anyone help me on below code: siblings(".selected").each(function () {
data.instance.check_node(this, 0);
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
想通了,将代码粘贴到这里以防有人需要参考或给我评论来优化它,谢谢。
figured out, paste code here in case someone needs reference or give me comment to optimize it, thanks.