PDA

View Full Version : Issue with programmatically selecting a tree item



nickibckr
19 Feb 2009, 1:36 PM
My tree needs to repopulate each time information is submitted to the server (from a FormPanel).
I look up the previously selected item, and appear to find it OK, but when I call

navTree.getSelectionModel().select(item2);

the item does not appear selected on the screen (code says it is selected).

Here is the actual code:




public void navigateTree(){
//find the item that was selected before the tree was refreshed
TreeModel tempModel = (TreeModel) store.findModel("index", selectedIdx);
TreeItem item2 = (TreeItem) binder.findItem(tempModel);
//Select this item in the current tree
navTree.getSelectionModel().select(item2);
//move to the previous or next page if the user chose this option.
if (goNextPage)
navTree.getSelectionModel().selectNext();
if(goPreviousPage)
navTree.getSelectionModel().selectPrevious();

}



Am I missing a piece somewhere? Do I need to update one more thing for it to appear selected?