PDA

View Full Version : TreeNode toggle function



shico
2 Feb 2010, 7:28 AM
Hello everybody!

I have extJS TreePanel with only to levels. Parent nodes - children nodes. I need check all child nodes when parent node is checked and unchek them when it is uncheked.
Here is my code. Please note that alerts are shown properly (as desired) but still not toggling :( Any suggestions? Thank you!



treePanel.on("checkchange", function( treenode, checked){
if(!treenode.isLeaf()){
for (var i = 0; i < treenode.childNodes.length; i++)
if (checked)
{
if (!treenode.childNodes[i].attributes.checked)
{
treenode.childNodes[i].toggle();
alert('checked ON');
}
}
else
{
if (treenode.childNodes[i].attributes.checked)
{
treenode.childNodes[i].toggle();
alert('checked OFF');
}
}
}
});

micgala
3 Feb 2010, 7:45 AM
Hi.
You better move this to ext-js forum.