单击父节点时检查树的子节点 [ExtJS] [英] check child nodes of a tree when a parent is clicked [ExtJS]
本文介绍了单击父节点时检查树的子节点 [ExtJS]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何在单击 ExtJs 中的特定节点时检查树的兄弟节点.
I would like to know how can i check the sibling nodes of a tree while clicking on a particular node in ExtJs.
我已经为每个节点提供了 id,我可以访问被点击节点的 id.那么我怎样才能继续自动检查子节点??
I had given id's for each node and i can access the id of a clicked node. then how can i proceed to checking the child nodes automatically ??
有人请帮我..
推荐答案
// or any other way of getting hands on the node you want to work with
var node = treePanel.getNodeById('your-id');
node.eachChild(function(n) {
n.getUI().toggleCheck(true);
});
如果你想让它在当前节点的整个子树上工作,你必须做一些递归.
If you want this to work on the whole subtree of the current node, you'll have to do some recursion.
更加集成:
treePanel.on('checkchange', function(node, checked) {
node.eachChild(function(n) {
n.getUI().toggleCheck(checked);
});
});
这篇关于单击父节点时检查树的子节点 [ExtJS]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文