PDA

View Full Version : Building a tree



Tereno
8 Jul 2008, 3:40 PM
I've looked at the samples and they all show this:

// quick way to build tree from Model instances.
TreeBuilder.buildTree(tree, TestData.getTreeModel());


How do I actually build a tree step by step? I am not sure about how to go about building the model data even. I just have a list of menu items and such that I would like to put in a tree. That's all. Thanks.

zaccret
9 Jul 2008, 12:44 AM
The simplest way without models is to add TreeItems to TreeItems.
You must begin by tree.getRootItem().add(treeItem);

zaccret
9 Jul 2008, 7:53 AM
This a bug from GXT, you should post it in the Bug forum.
But I think you can do it by adding first the item to the tree :


TreeItem root = new TreeItem("Options");
TreeItem camera = new TreeItem("Cameras");
tree.getRootItem().add(root);
root.add(camera);

Tereno
9 Jul 2008, 7:55 AM
Yeah that pretty much fixed the problem that I had. Thanks!