当某些节点被选中/取消选中时,自动选中/取消选中 extjs 树中的所有子树节点 [英] Automatically check/uncheck all subtree nodes in extjs tree when certain node gets checked/unckecked

查看:31
本文介绍了当某些节点被选中/取消选中时,自动选中/取消选中 extjs 树中的所有子树节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当某个节点被选中/取消选中时,如何自动选中/取消选中 extjs 树中的所有子树节点.我已经有了带有复选框的树.唯一缺少的是这种检查/取消检查行为.我发现了这个:检查子节点单击父级时的一棵树 [ExtJS] ,但它对我不起作用,因为 extjs API 似乎已更改.

How do I automatically check/uncheck all subtree nodes in an extjs tree when a certain node gets checked/unckecked. I already have my tree with checkboxes. The only thing missing is this check/unckeck behavior. I found this: check child nodes of a tree when a parent is clicked [ExtJS] , but it doesn't work for me because the the extjs API seems to be changed.

推荐答案

我找到了解决方案:

oncheckchange = function(node, checked, options){
    node.cascadeBy(function(n){n.set('checked', checked);} );
};

tree.on('checkchange', oncheckchange, null);

这篇关于当某些节点被选中/取消选中时,自动选中/取消选中 extjs 树中的所有子树节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆