PDA

View Full Version : TreeViewer only refreshes if (either no children or not expanded not sure)



cdasher
24 Apr 2008, 1:23 PM
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.

darrellmeyer
27 Apr 2008, 8:46 AM
Can you provide a simple code sample that demonstrates the problem you are seeing?

cdasher
28 Apr 2008, 5:38 AM
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.