Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
hierarchical container iteration
Hi:
The getIdByIndex(i) method doesn't work for hierarchical containers, so I'm not sure how to iterate over it...
I'm try this with a treetable (tree):
for (int i = 0; i < tree.getContainerDataSource().size(); i++) {
Item item = tree.getContainerDataSource().getItem(tree.getContainerDataSource().getItemIds());
Object value =item.getItemProperty(PROPERTY).getValue();
}
...but it gives me a null pointer exception error....I'm not sure how to fix this...any idea??
regards and ,as always, thank you very much....
ps.- I posted this comment in another thread and tried to erase it, but it didn't work, sorry about that....
you can get item by getItemProperty
see example below:
for (int i = 1; i <= treeT.getContainerDataSource().size(); i++)
{
// you can get item like this.
String name = treeT.getContainerDataSource().getItem(i).getItemProperty("Type A").toString();
}