With MyGWT, to add a child to a tree, i had only to do model.add(child).
But with GXT, it seems that's don't work.
The "child" TreeItem is never showed.
What's wrong with my code ?
Code:
public class Test implements EntryPoint {
/**
* This is the entry point method.
*/
public void onModuleLoad() {
Tree tree = new Tree();
BaseTreeLoader loader = new BaseTreeLoader(new TreeModelReader());
TreeStore<Model> store = new TreeStore<Model>(loader);
TreeBinder<Model> binder = new TreeBinder<Model>(tree, store);
store.setModelComparer(new DefaultModelComparer<Model>());
store.setMonitorChanges(true);
binder.setDisplayProperty("name");
Window window = new Window();
window.setLayout(new FitLayout());
window.add(tree);
BaseTreeModel root = new BaseTreeModel();
root.set("name", "ROOT");
// add the root
store.add(root, true);
BaseTreeModel child = new BaseTreeModel();
// add one child
child.set("name", "CHILD");
store.add(root, child, true);
window.show();
// only one node is show
// "child" is not added to the Tree
}
}