After updating a tree item on the tree store using TreeStore.update(), calling TreePanelSelectionModel.getSelectedItem() results in a stale item being returned.
I'm making a call to update an item on a tree store as follows:
Code:
BeanModel itemModel = beanModelFactory.createModel(item);
tree.getStore().update(itemModel);
The new tree item appears correctly in the tree based on the icon, as set in a custom iconSelector. That is, the items being passed to the icon selector include the updated item. Checking the actual TreeStore pointed to by both the TreePanel and the selection model shows that the updated item is indeed present in the tree store. The stale item does not exist in the store after the update.
I'm getting the currently selected item as follows:
Code:
TreePanelSelectionModel<BeanModel> selModel = tree.getSelectionModel();
BeanModel model = selModel.getSelectedItem();
The model item is the pre-updated item (again, an item that does not exist in TreeStore, post update). However, Looking at the node list in the TreePanel itself shows the stale item is still in the node list. My understanding is that the update call on the tree store fires the Update event. Shouldn't this event result in updating the nodes in the tree?
How can I force the tree to see the update to the treestore? I need to have the selected item reflect the current item in the TreeStore, not a stale item held in the TreePanel.
Thanks!