5 Replies Latest reply on Nov 13, 2007 10:29 AM by damianharvey

    Using Ajax4JSF reRender inside a loop (ui:repeat or a4j:repe

    erik.d.hellman

      I have a loop in my JSF page generated with ui:repeat. Inside that loop I have a h:selectOneMenu with a a4j:support side it. I also have a a4j:outputPanel inside the loop. My question is how I can make my selectOneMenu trigger a reRender of the correct a4j:outputPanel. I tried setting the id and reRender attributes of the a4j:outputPanel and a4j:support to the id of the entities I iterate over, but that doesn't work.

      The code looks something like this:

      <ui:repeat var="dayTime" value="#{planWorkBean.dayTimes}">
       <h:selectOneMenu value="#{dayTime.workShift}">
       <s:selectItems value="#{workShifts}" var="workShift" label="#{workShift.name}" noSelectionLabel="-" />
       <s:convertEntity />
       <a4j:support action="#{dayTime.setWorkShift(workShift)}" event="onchange" reRender="#{dayTime.id}" />
       <h:selectOneMenu>
      
       <a4j:outputPanel id="#{dayTime.id}">
       <h:outputText value="#{dayTime.workShift.totalTime}" converter="HourMinuteConverter" />
       </a4j:outputPanel>
      </ui:repeat>


      Everything but the reRendering works great. The entity is updated at the onchange event, but the a4j:outputPanel is not updated.

      I guess I can't use EL-expressions for the id-attribute in JSF-tags, but how else am I supposed to refer to the correct a4j:outputPanel?

      Thanks,
      Erik