5 Replies Latest reply on Oct 29, 2009 6:30 PM by Nick Belaevski

    <ui:repeat> and <a4j:support />

    Matthias Age Newbie

      Hi,

      I use a <ui:repeat> component to iterate over a list. Inside the repeater I would like to reRender some part

      <ui:repeat value=#{myList}" var="element">
      <h:selectOneRadio>
      </h:selectOneRadio>

      </ui:repeat>

        • 1. Re: <ui:repeat> and <a4j:support />
          Ilya Shaikovsky Master

          check a4j:repeat demo. ui:repeat not supports partial updates inside.

          • 2. Re: <ui:repeat> and <a4j:support />
            Matthias Age Newbie

            Hi,

            sorry, I submitted the first post accidentally.
            Here's the complete question:
            I use a <ui:repeat> component to iterate over a list. Inside the repeater I would like to reRender some part, e.g. I woule like to iterate over some kind of questions, with answers YES, NO, etc (radio buttons in the example below).
            If the user selects the answer NO, I would like to reRender the selectOneMenu component for this question (in order to enable it) where the user then can select from a list why he answered NO.

            <ui:repeat value=#{myList}" var="element">
            <h:outputText value="{element.question}" />
            <h:selectOneRadio id="answer"...>
             <f:selectItems .... />
             <a:support event="onchange" reRender="interventi"></a:support>
            </h:selectOneRadio>
            
            <h:selectOneMenu id="interventi" >
             <f:selectItems value="#{}" />
            </h:selectOneMenu>
            </ui:repeat>


            But this does not work because the id "interventi" is not correct.
            How can I solve this?

            thanks
            Matthias

            • 3. Re: <ui:repeat> and <a4j:support />
              Ilya Shaikovsky Master

              read my previous post.. I gues it actual for full description also ;)

              • 4. Re: <ui:repeat> and <a4j:support />
                Matthias Age Newbie

                Thanks for your immediate response.

                But does the example also work for nested <a4j:repeat>?
                Because in my example I have 2 loops (I simplified in the previous post)
                1st loop: category of question
                2nd loop: questions for current category

                Is it enough to have 2 UpdateBeans (where UpdateBean refers to the example class on the richfaces demo page)?
                Do these UpdateBeans have to be related in a hierarchical manner (reflecting the repeater hierarchy)?
                I just don't understand how to apply the example to my situation.

                Thx
                Matthias

                • 5. Re: <ui:repeat> and <a4j:support />
                  Nick Belaevski Master

                  Hi Matthias,

                  Yes, nested repeats this will also work. If you need to update just one question, there's no need to use hierarchy for beans containing keys.