3 Replies Latest reply on Jun 26, 2012 6:34 AM by Brendan Healey

    problem with update model from a4j:repeat in every time ajax request

    Marcus Vinicius Silva Newbie

      Hello,

       

      Every time I run an ajax call, the richfaces invokes the method on the model of component a4j:repeat ou a4j:datatable. I just wish the richfaces update the model of these, only when I add them in the list of objects to render.

       

      See below, how can i am doing it:

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

          xmlns:h="http://java.sun.com/jsf/html"

          xmlns:f="http://java.sun.com/jsf/core"

          xmlns:ui="http://java.sun.com/jsf/facelets"

          xmlns:a4j="http://richfaces.org/a4j"

          xmlns:rich="http://richfaces.org/rich">

       

       

      <ui:composition template="/template/commonLayout.xhtml">

       

       

          <ui:define name="content">

      <h:outputStylesheet>

              .outhello {

              font-weight: bold;

              }

          </h:outputStylesheet>

          <a4j:region id="rg1">

          <h:form id="form1">

              <h:panelGrid columns="3">

                  <h:outputText value="Name:" />

                  <h:inputText value="#{testeBean.nome}" />

                  <a4j:commandButton value="Say Hello" render="out" execute="@form"  limitRender="true"/>

              </h:panelGrid>

          </h:form>

          <br />

          <a4j:outputPanel id="out">

              <h:outputText value="Hello #{testeBean.nome} !" styleClass="outhello" />

          </a4j:outputPanel>

          </a4j:region>

          <a4j:log />

       

          <a4j:outputPanel id="out2">

       

              <h:outputText value="Data2  #{testeBean.date} !" rendered="true" styleClass="outhello" />

          </a4j:outputPanel>

       

       

         <a4j:outputPanel id="out3">

              <h:outputText value="Data2  #{clienteAction.clientes.size()} !" rendered="true" styleClass="outhello" />

          </a4j:outputPanel>

       

         <a4j:repeat var="c" value="#{clienteAction.clientes}">

              <tr>

                  <td>

                      <h:outputText value="#{c.id}" />

                  </td>

              </tr>

          </a4j:repeat>

       

          </ui:define>

      </ui:composition>

      </html>

       

       

       



       

       

       

      When i click on command button. It just try render e update model from out component and always call the method defined as #{clienteAction.clientes} by a4j:repeat or a4j:datatable component type.

       

      PS: I only have this problem with a4j:repeat or a4j:datatable.

       

      What am i doing wrong? Could someone help me?