Automatically check/uncheck all subtree nodes in extjs tree when certain node gets checked/unckecked
Asked Answered
O

1

9

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.

Oscoumbrian answered 5/7, 2011 at 8:24 Comment(1)
Which version of ExtJS are you using?Consistory
O
23

I found a solution:

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

tree.on('checkchange', oncheckchange, null);
Oscoumbrian answered 21/7, 2011 at 11:17 Comment(2)
This solution is correct for [ExtJs] 4.0. It doesn't work with older versions.Charlatanism
I'm using the .set method, the check changes, but the checkchange event is not fired...Palladio

© 2022 - 2024 — McMap. All rights reserved.