PDA

View Full Version : tree selectionmodel deselect problem



sz_146
18 Jun 2009, 3:55 AM
Using GXT 2 M3, I have 2 TreePanels in my application. I have to deselect all items in one tree if any node is clicked/selected in the other one.

I supposed the TreePanelSelectionModel's deselect methods should do the job. However it doesn't work. I tried to get the selected item after executing the deselectAll() and it still returns the item !!!



// tree is a TreePanel<GenericTreeModel>
// selectedModel is a class variable
// getSelectedModel() is a local method

public static void setSelectedModel(GenericTreeModel m){

selectedModel = m;
if(m == null){
tree.getSelectionModel().deselectAll();
// this still returns the item/model
GenericTreeModel cm = tree.getSelectionModel().getSelectedItem();
}else{
LibTree.setSelectedModel(null);
}

}