5 Replies Latest reply on Jan 7, 2013 7:11 AM by Navin K

    remove InputFile dynamically

    Habib Eslami
      Hi everybody,
      my english isn't very good.
      I use JDeveloper

      I create an InputFile component dynamically in a bean.
      RichInputFile if_test = new RichInputFile();

      but sometimes I should remove this component .How can I remove InputFile dynamically.

        • 1. Re: remove InputFile dynamically
          Sudipto Desmukh
          should work.
          • 2. Re: remove InputFile dynamically
            Habib Eslami

            but how can I get <indexOfAddedElement> ?

            I do this : pgl10.getChildren().remove(pgl10.findComponent("ComponentID"));
            but it doesn't work
            • 3. Re: remove InputFile dynamically
              Timo Hahn
              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.

              • 4. Re: remove InputFile dynamically
                Habib Eslami
                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:

                1: result.remove(index);

                2: result.remove(ComponentID);

                • 5. Re: remove InputFile dynamically
                  Navin K
                  Hi Habib,

                  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.