TreeViewer only refreshes if (either no children or not expanded not sure)
TreeViewer only refreshes if (either no children or not expanded not sure)
I have an asynch Tree using TreeViewer and TreeContentProvider. I load the tree from the database and then add items via a form. When the call returns from the add item, I call
viewer.refresh(tree.getSelectedItem().getParent());
viewer.update(tree.getSelectedItem());
if (!tree.getSelectedItem().isExpanded()){
tree.getSelectedItem().setExpanded(true);
}
The FIRST time the new item is added to the tree and the parent is expanded works great. Subsequent calls and the tree never updates.
also happens if I call just the selectedItem and selectedItem.getElement
If I refresh the browser, I see the new items in the tree but cannot add a new one.
Last edited by cdasher; 24 Apr 2008 at 1:23 PM.
Reason: typo
After trying a couple of things I do not think this is a bug. However, could you provide a sample of using the Asynchronous TreeViewer with a model (extending BaseTreeModel) and adding or deleting new items and how to update the tree. The example of how to change the model and notify the viewer is not in the TreeViwer example you previously provided.