I have a question regarding treetables…I’m using the following code to set the parents of the treetable items and it doesn’t work…any ideas?..
public TreeTable prueba = new TreeTable();
...
prueba.addContainerProperty("Name", String.class, "");
prueba.addContainerProperty("Father", String.class, "");
for (int i = 0; i < contenedorUsers.size(); i++) {
Object id = contenedorUsers.getIdByIndex(i);
Item item = contenedorUsers.getItem(id);
prueba.addItem(new Object[] {item.getItemProperty("Name").getValue().toString(),
item.getItemProperty("Father").getValue().toString()},null);
}
After this, I get a treetable with two columns, one with the name and one for the father’s name…after that, I do:
for (int i=1; i<=prueba.size();i++){
Object name = prueba.getItem(i).getItemProperty("Name");
Object father = prueba.getItem(i).getItemProperty("Father");
prueba.setParent(name, father);
prueba.setCollapsed(name, false);
}
After this, nothing happens, and I only have the table with two columns but with no hiearchy on it…if I do this item by item (they are not too many yet)…I get a perfectly goo treetable…
or just use the item id’s that you get, like prueba.getItem(i);.
Your copying of items from one table to another looks like a weird thing to do. A little hard to say as I just see a fragment of the code. Also, it is a good practice to use only English in code (referring to prueba). It would be easier to help that way.