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.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 2 weeks ago
Remove Children of TreeTable
I'm trying to remove all children of parent in a TreeTable.
I can get the child ids, however it only removes the first child. (Table repaints and I guess I don't have that id anymore)
Collection<?> childrenIDs = expgrpgrid.getChildren(target);
for (java.util.Iterator<?> i = childrenIDs.iterator(); i.hasNext();){
expgrpgrid.removeItem(i.next());
}
Is there a way to do this?
Thank you for the help.
Last updated on
Hi,
I think it has to be with the collection size. Anyway, if you are using Java 8, you can do:
childrenIDs.stream().forEach(expgrpgrid::removeItem);
If not, you have to do something like:
Object[] toRemove = childrenIDs.toArray();
int size = toRemove.length;
for (int i = 0; i < size; i++) {
expgrpgrid.removeItem(toRemove[i]);
}
Hope that helps!
Last updated on
+1
You cannot reply to this thread.