PDA

View Full Version : How do i unselect all nodes in my TreePanel?



jscolton
10 Nov 2009, 8:23 AM
I have read the TreePanel API and come up with the following:

a) var selNodes = tree.getChecked();
Ext.each(selNodes, function(node){
node.unselect();
//tree.getSelectionModel().unselect(node);

alert("unselecting...");
});

- I see an alert per checked node, but nothing else happens.

b) var treeSelectionModel = tree.getSelectionModel();
treeSelectionModel.clearSelections(true);

c) var treeSelectionModel = tree.getSelectionModel();
treeSelectionModel.clearSelections();

This is driving me nuts! Any ideas?

Thanks
Jeremy

Animal
10 Nov 2009, 8:32 AM
I think that checked !== selected.

Animal
10 Nov 2009, 8:36 AM
So 2 minutes of glancing at the API docs has me imagining code like



Ext.each(myTreePanel.getChecked(), function(n) {
n.getUI().toggleCheck(false);
});

jscolton
10 Nov 2009, 11:43 PM
Wow - it works :)

The "Learning ExtJs" book doesn't mention getUI() once! So it seems that extjs components have both a model and a ui element?? This is a very important concept.

Thanks you so much for helping me and teaching me a great deal about how to manipulate extjs components.

Jeremy