5 Replies Latest reply on Oct 3, 2007 2:48 PM by Ariel Fernando

    scrollableDataTable and a4j:commandLink

    Ariel Fernando Newbie

      Hi All,
      I have some problems when try to do a reRender from a <a4j:commandLink> that is nested in a <rich:scrollableDataTable>. If a put the same <a4j:commandLink> outside scrollableDataTable, all works fine...but not inside.

      Currently I'm used:

      Tomcat 5.5.23
      Richfaces 3.1.0
      Trinidad 1.0.1
      Tomahawk 1.1.6
      MyFaces 1.1.5

      And the code that don´t works whit reRender is:

      <a4j:form id="formLista">
      <rich:scrollableDataTable id="idListaPaises" value="#{pais.listPaises}"
       rowKeyVar="rowKey" var="row"
       height="250px" width="400px" rows="0"
       sortMode="single" frozenColCount="1">
       <rich:column id="codeName">
       <f:facet name="header">
       <h:outputText value="#{tag.countryName}" />
       </f:facet>
       <h:outputText value="#{row.codeName}" />
       </rich:column>
       <rich:column id="nombre">
       <f:facet name="header">
       <h:outputText value="#{tag.codeName}" />
       </f:facet>
       <h:outputText value="#{row.nombre}" />
       </rich:column>
       <rich:column id="acciones" sortable="false">
       <f:facet name="header">
       <h:outputText value="Action" />
       </f:facet>
       <a4j:commandLink id="idLnkEdit" value="Edit"
       actionListener="#{newCountry.editPais}"
       reRender="idSubView:idPanelFormCountry, idSubView:prueba2"
       immediate="true">
       <a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender" />
       <a4j:actionparam value="#{row.id}"
       assignTo="#{newCountry.id}" />
       </a4j:commandLink>
       </rich:column>
       </rich:scrollableDataTable>
       </a4j:form>


        • 1. Re: scrollableDataTable and a4j:commandLink
          Sergey Smirnov Master

          I am not sure, is it related issue or not, but when I hear about Tomahawk 1.1.6, the very old prototype.js version is in front of my eyes

          http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086928#4086928

          • 2. Re: scrollableDataTable and a4j:commandLink
            Maksim Kaszynski Apprentice

            I think it's simpler.

            ScrollableDataTable is a naming container, as any UIData is. So you just can't get idSubView:idPanelFormCountry, idSubView:prueba2 rerendered because they cannot be found INSIDE the table. Use absolute ids to be able to locate them.

            • 3. Re: scrollableDataTable and a4j:commandLink
              Jon Zuccaro Newbie

              Hi! I have the same issue, looks like reRender is not the problem, are you sure that the action method is ever called?

              In my case the action is never called (for now, it is a simple System.out.println to confirm that the code was reached),
              the clicked row is highlighted but nothing happens

              It works perfectly if I change rich:scrollableDataTable with rich:dataTable, and it also works if I put the commandLink outside the richTable

              I am begining to suspect that I am doing something wrong

              Windows XP
              jsf-impl 1.1 (Sun)
              richfaces 3.1.0
              JBoss 4.0.4

              The Jsp:

              <h:form id="miForma">
              .....
              <rich:scrollableDataTable width="700px" id="carList" rows="40"
               height="300px" value="#{recepcion.requisiciones}" var="req">
              
               <rich:column id="make">
              
               <f:facet name="header">
               <h:outputText styleClass="headerText" value="Make" />
               </f:facet>
              
               <h:outputText value="#{req.fecha}" />
              
               </rich:column>
              
               <rich:column id="model">
              
               <f:facet name="header">
               <h:outputText styleClass="headerText" value="Model" />
               </f:facet>
              
               <a4j:commandLink action="#{indexRecepcion.verDetallesRequisicion}"
               reRender="miForma" value="#{req.hora}">
               </a4j:commandLink>
              
               </rich:column>
              
              </rich:scrollableDataTable>
              
              </h:form>


              indexRecepcion = Bean of scope request
              recepcion = Bean of scope request
              requisiciones = ArrayList



              verDetallesRequisicion is never reached

              • 4. Re: scrollableDataTable and a4j:commandLink
                Ariel Fernando Newbie

                Hi jzuccaro!.

                Mmm....no, the action method is never called. I put some breakpoints and run debug. The last two days I'm upgrade to JSF 1.2, and same trouble, commandLink never trigger reRender and don't call action method.

                Now I tested with:

                Tomcat 6.0.14
                Richfaces 3.1.0
                Trinidad 1.2.2
                Tomahawk 1.1.6
                JSF Sun RI 1.2.04 (i have fatals problems with myfaces 1.2).

                Now I'm trying to replace a4j:commandLink with tr:commandLink, and use Trinidad PPR...

                What's about maksimkaszynski suggest?. Can you try it?.

                Best regards,

                • 5. Re: scrollableDataTable and a4j:commandLink
                  Ariel Fernando Newbie

                  I try absolutes IDs:

                  From commandLink scrollableDataTable inside, don't work

                  <a4j:commandLink id="idLink" value="Edit"
                   action="#{newCountry.editPais}" reRender=":idSubView:idPanelFormCountry"> <a4j:actionparam value="18" assignTo="#{newCountry.id}" /> <a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender" />
                  </a4j:commandLink>
                  


                  And, same code (whith another commandLink id, of course), outside scrollableDataTable works fine... :(

                  I'm review my generated HTML and it show something strange, all "commandLinks" (<a href..>) have the same ID. This is a fragment:

                  ...
                  <!--Start: javax.faces.Command["idLink"]--><a href="#" id="idSubView:formLista:idListaPaises:idLink" name="idSubView:formLista:idListaPaises:idLink" onclick="A4J.AJAX.Submit('j_id_jsp_559877472_0','idSubView:formLista',event,{'parameters':{'idSubView:formLista:idListaPaises:idLink':'idSubView:formLista:idListaPaises:idLink','idSubView:formLista:idListaPaises:0:j_id_jsp_559877472_40':'18'} ,'actionUrl':'/eController2/faces/newCountry.jsp'} );return false;">Edit</a>
                  ...
                  <a href="#" id="idSubView:formLista:idListaPaises:idLink" name="idSubView:formLista:idListaPaises:idLink" onclick="A4J.AJAX.Submit('j_id_jsp_559877472_0','idSubView:formLista',event,{'parameters':{'idSubView:formLista:idListaPaises:idLink':'idSubView:formLista:idListaPaises:idLink','idSubView:formLista:idListaPaises:0:j_id_jsp_559877472_40':'18'} ,'actionUrl':'/eController2/faces/newCountry.jsp'} );return false;">Edit</a>
                  


                  Then, console output show this:

                  ADVERTENCIA: The id "org.ajax4jsf.view.state" is used more than once.
                  


                  And, finally, a trace JSF lifecycle with PhasesTracker, and, when I click on commandLink that is outside scrollableDataTable, I get:

                  03/10/2007 15:43:15 org.exadel.jsf.PhaseTracker beforePhase
                  INFO: BEFORE RESTORE_VIEW 1
                  03/10/2007 15:43:15 org.exadel.jsf.PhaseTracker afterPhase
                  INFO: AFTER RESTORE_VIEW 1
                  03/10/2007 15:43:15 org.exadel.jsf.PhaseTracker beforePhase
                  INFO: BEFORE APPLY_REQUEST_VALUES 2
                  03/10/2007 15:43:15 org.exadel.jsf.PhaseTracker afterPhase
                  INFO: AFTER APPLY_REQUEST_VALUES 2
                  03/10/2007 15:43:15 org.exadel.jsf.PhaseTracker beforePhase
                  INFO: BEFORE PROCESS_VALIDATIONS 3
                  03/10/2007 15:43:15 org.exadel.jsf.PhaseTracker afterPhase
                  INFO: AFTER PROCESS_VALIDATIONS 3
                  03/10/2007 15:43:15 org.exadel.jsf.PhaseTracker beforePhase
                  INFO: BEFORE UPDATE_MODEL_VALUES 4
                  03/10/2007 15:43:15 org.exadel.jsf.PhaseTracker afterPhase
                  INFO: AFTER UPDATE_MODEL_VALUES 4
                  03/10/2007 15:43:15 org.exadel.jsf.PhaseTracker beforePhase
                  INFO: BEFORE INVOKE_APPLICATION 5
                  THIS IS PRINTED FROM ACTION LISTENER METHOD!!! WORKS FINE.
                  03/10/2007 15:43:15 org.exadel.jsf.PhaseTracker afterPhase
                  INFO: AFTER INVOKE_APPLICATION 5
                  03/10/2007 15:43:15 org.exadel.jsf.PhaseTracker beforePhase
                  INFO: BEFORE RENDER_RESPONSE 6
                  03/10/2007 15:43:15 org.apache.myfaces.trinidadinternal.io.DebugResponseWriter _logDuplicateId
                  ADVERTENCIA: The id "org.ajax4jsf.view.state" is used more than once.
                  03/10/2007 15:43:15 org.exadel.jsf.PhaseTracker afterPhase
                  INFO: AFTER RENDER_RESPONSE 6
                  


                  And this ocurred when I click on commandLink from scrollableDataTable:

                  03/10/2007 15:46:34 org.exadel.jsf.PhaseTracker beforePhase
                  INFO: BEFORE RESTORE_VIEW 1
                  03/10/2007 15:46:34 org.exadel.jsf.PhaseTracker afterPhase
                  INFO: AFTER RESTORE_VIEW 1
                  03/10/2007 15:46:34 org.exadel.jsf.PhaseTracker beforePhase
                  INFO: BEFORE APPLY_REQUEST_VALUES 2
                  03/10/2007 15:46:34 org.exadel.jsf.PhaseTracker afterPhase
                  INFO: AFTER APPLY_REQUEST_VALUES 2
                  03/10/2007 15:46:34 org.exadel.jsf.PhaseTracker beforePhase
                  INFO: BEFORE PROCESS_VALIDATIONS 3
                  03/10/2007 15:46:34 org.exadel.jsf.PhaseTracker afterPhase
                  INFO: AFTER PROCESS_VALIDATIONS 3
                  03/10/2007 15:46:34 org.exadel.jsf.PhaseTracker beforePhase
                  INFO: BEFORE UPDATE_MODEL_VALUES 4
                  03/10/2007 15:46:34 org.exadel.jsf.PhaseTracker afterPhase
                  INFO: AFTER UPDATE_MODEL_VALUES 4
                  03/10/2007 15:46:34 org.exadel.jsf.PhaseTracker beforePhase
                  INFO: BEFORE INVOKE_APPLICATION 5
                  03/10/2007 15:46:34 org.exadel.jsf.PhaseTracker afterPhase
                  INFO: AFTER INVOKE_APPLICATION 5
                  03/10/2007 15:46:34 org.exadel.jsf.PhaseTracker beforePhase
                  INFO: BEFORE RENDER_RESPONSE 6
                  03/10/2007 15:46:34 org.apache.myfaces.trinidadinternal.io.DebugResponseWriter _logDuplicateId
                  ADVERTENCIA: The id "org.ajax4jsf.view.state" is used more than once.
                  03/10/2007 15:46:34 org.exadel.jsf.PhaseTracker afterPhase
                  INFO: AFTER RENDER_RESPONSE 6
                  


                  Look that nothing happend on phase 5.