Reputation: 2247
Is there a way to check/uncheck a node in extJS tree, if all we have is just the node name (with parent names till root). I am using ExtJS 3.3.0, couldnt find any method in the API documentation
Upvotes: 1
Views: 2885
Reputation: 23973
First: I guess the name does not match the Id of the node otherwise you are done with treePanel.getNodeById()
API link
You have the path of the node given the the node.getPath()
You just need to call
treePanel.expandPath(path, null, function(bSuccess, oLastNode){ oLastNode.select() });
treePanel.expandPath(path, null, function(bSuccess, oLastNode){ oLastNode.unselect() });
with name you are meaning the text property of the node that does not match the node id or any other accessible attribute on the node:
finally you will reach your target node. Know you just need to call
Please note that I did not test the select / unselect behavior but it should check / uncheck the combo. for collapsing use either toggle()
if you just want to change the state or collapse()
/ expand()
Upvotes: 2