1 Reply Latest reply on Oct 25, 2011 9:09 AM by Heitor Rosa Faustino dos Santos

    RF 3.3.0 does not handle ui:repeat attibute varStatus after an ajax page re-rendering?

    Leo K Newbie

      Hi

       

      I have a xhtml page with something like this

       

      <ui:repeat var="item" varStatus="x" value="#{someList}">

      <h:outputLabel value="y" rendered="#{x.index eq 1}"/>

      <ui:repeat var="subItem" value="#{item}">

      <h:outputLabel value="z"/>

      </ui:repeat>

      </ui:repeat>

       

      It works fine when the page is first rendered, let´s suppose, it generates "yzzz"

       

      Then, I trigger an a4j:commandButton and, suddenly, I got "zzz" only, as x was null.

       

      If I go to another page and then come back, the page is rendered perfectly again.

       

      It **seems** that when richfaces must re-render some portion of the page via ajax, it simply ignores the varStatus information.

       

      Does anyone have noticed this too?

       

      Best regards

       

      Leo K.

        • 1. Re: RF 3.3.0 does not handle ui:repeat attibute varStatus after an ajax page re-rendering?
          Heitor Rosa Faustino dos Santos Newbie

          Leo K wrote:

           

          Hi

           

          I have a xhtml page with something like this

           

          <ui:repeat var="item" varStatus="x" value="#{someList}">

          <h:outputLabel value="y" rendered="#{x.index eq 1}"/>

          <ui:repeat var="subItem" value="#{item}">

          <h:outputLabel value="z"/>

          </ui:repeat>

          </ui:repeat>

           

          It works fine when the page is first rendered, let´s suppose, it generates "yzzz"

           

          Then, I trigger an a4j:commandButton and, suddenly, I got "zzz" only, as x was null.

           

          If I go to another page and then come back, the page is rendered perfectly again.

           

          It **seems** that when richfaces must re-render some portion of the page via ajax, it simply ignores the varStatus information.

           

          Does anyone have noticed this too?

           

          Best regards

           

          Leo K.

           

          Hi Leo,

           

          I resolved this with a simple solution.

          I called the method indexOf of the List for each iteration of the ui:repeat. Something like this:

           

          <ui:repeat var="item" varStatus="x" value="#{someList}">

               <h:outputLabel value="y" rendered="#{x.index eq 1}"/>

               <h:outputLabel value="y" rendered="#{someList.indexOf(item) eq 1}"/>

                    <ui:repeat var="subItem" value="#{item}">

                         <h:outputLabel value="z"/>

                    </ui:repeat>

          </ui:repeat>

           

          The method indexOf return the current position of the object inside the list.

          This work fine for me!