Question

In a checkable tree panel I want all children of a checked node be checked automatically. How can I do that?

Was it helpful?

Solution

Try adding a listener like this to your tree store:

listeners: {
    update: function(store,node,op,modifiedFields){
         //If our checked value has changed
         if(modifiedFields && Ext.Array.contains(modifiedFields,'checked')){ 
             var isChecked = node.get('checked');
             node.eachChild(function(childNode){
                  //set each child node to it's parent's checked value
                  childNode.set('checked',isChecked); 
             });
         }
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top