This content has been marked as final. Show 5 replies
but how can I get <indexOfAddedElement> ?
I do this : pgl10.getChildren().remove(pgl10.findComponent("ComponentID"));
but it doesn't work
The getChildren () method returns a list of UIComponent, so to remove an element from a list you have to use the index of the element in the list. Using the component ID won't work.
You can remove the element from the list using the element itself, meaning you have the inputFile component as a reference, you can use getChildren().remove(ref_inputfile);
Or you can iterate over the child elements to get the index of the component to remove.
I write follow code:
List<UIComponent> result = (List)new ArrayList<UIComponent>();
result = pgl10.getChildren();
int index = result.indexOf(ComponentID);
then to remove a component,I use two ways but none of them don't work:
Have you tried refreshing the container of the component after removing the component ?
As Timo said you wont be able to remove the component using ID.
if you have
RichInputFile if_test = new RichInputFile();try removing by getChildren().remove(if_test); and after that refresh the container containing that component.