Does anyone know how to remove Treeitems from a Treechildren node in ZK? I have tried using an iterator and removeChild but a ConcurrentModificationException!
List<Treeitem> myTreeItems = treechildren.getChildren();
Iterator<Treeitem> iterator = myTreeItems.iterator();
while (iterator.hasNext()){
myItem = (Treeitem)iterator.next();
parent.removeChild(myItem);
}
Any ideas?
From stackoverflow
-
That is not the correct way to remove the items, you need to do something like this.
while (parent.getItemCount() > 0) { parent.removeChild(parent.getFirstChild()); }This will provide the functionality that you require!
More details on using the Tree component are available here.
Justin.Eckner : Thanks, worked like a charm! -
As what I saw in your case you want to remove all components which are all attached on a
treechildren. I think the fastest way is:treechildren.getChildren().clear();just operate the result like a
java.util.List.
0 comments:
Post a Comment