springrider
21 Oct 2010, 5:15 AM
Good morning
I have a treenode with a node (A) with 3 children(1,2,3)
A
|_1
|_2
|_3
I would like when i check/uncheck the parent A that all the children are checked/unchecked.
If all the nodes are unchecked initially, I would like to check A when I check at least one of the children.
I wrote the folowing code:
,listeners: {checkchange: {fn: function(node, checked){
node.eachChild(function(n) {
n.getUI().toggleCheck(checked);
});
node.parentNode.getUI().toggleCheck(checked);
Each behaviour is working fine individually but not when they are both combined.
In fact,now, if all my nodes were unchecked (both parent and children) and I check one of the children, the current code checks the parent and all the children....
Hope it is clear enough.
Anyone having an idea.
Thanks in advance
Sylvain
I have a treenode with a node (A) with 3 children(1,2,3)
A
|_1
|_2
|_3
I would like when i check/uncheck the parent A that all the children are checked/unchecked.
If all the nodes are unchecked initially, I would like to check A when I check at least one of the children.
I wrote the folowing code:
,listeners: {checkchange: {fn: function(node, checked){
node.eachChild(function(n) {
n.getUI().toggleCheck(checked);
});
node.parentNode.getUI().toggleCheck(checked);
Each behaviour is working fine individually but not when they are both combined.
In fact,now, if all my nodes were unchecked (both parent and children) and I check one of the children, the current code checks the parent and all the children....
Hope it is clear enough.
Anyone having an idea.
Thanks in advance
Sylvain