1 2 Previous Next 20 Replies Latest reply on Dec 13, 2007 5:26 PM by Michael

    scrollableDataTable and commandLink

    Jon Zuccaro Newbie

      Hi! Why can't I use a commandLink inside a scrollableDataTable?

      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:

      Code:

      <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

        • 1. Re: scrollableDataTable and commandLink
          Ilya Shaikovsky Master

          Strange..

          <rich:scrollableDataTable width="300px" height="400px" value="#{capitalsBean.capitals}" var="cap">
           <rich:column>
           <h:inputText value="#{cap.name}" styleClass="myClass"/>
           </rich:column>
           <rich:column>
           <h:outputText value="#{cap.state}"/>
           </rich:column>
           <rich:column>
           <a4j:commandLink value="simple" action="#{bean.action}"></a4j:commandLink>
           </rich:column>
          </rich:scrollableDataTable>


          and

          public String action() {
           System.out.println("action called");
           return null;
           }
          


          And I'm able to see the output from the console.
          Bean - request
          CapitalsBean - session

          JSF 1.2_04
          Facelets 1.1.12
          RF 3.1.1 SNAPSHOT
          Tomcat 6

          please use phasetracker to get info about the JSF phase that failed to be processed normally.


          • 2. Re: scrollableDataTable and commandLink
            Alexandre Reis Newbie

            Having the exact same problem under Sun JSF RI 1.1_02.

            <h:commandLink> and <h:commandButton> don't call their action methods when used inside a rich:scrollableDataTable. Changing it for a rich:dataTable fixes the problem (although i need the ajax scrolling functionallity in my app so I still have a problem).

            Anyone found a solution yet?

            • 3. Re: scrollableDataTable and commandLink
              Sergey Smirnov Master

              <h:commandLink> and <h:commandButton> don't call OR just <h:commandLink> ?

              • 4. Re: scrollableDataTable and commandLink
                Alexandre Reis Newbie

                h:commandLink> AND <h:commandButton> - not necessarily together, happens with both, whether there's only one of them, or if they are isolated or on the same cell.

                • 5. Re: scrollableDataTable and commandLink
                  Alexandre Reis Newbie

                  Btw, I'm using Tomcat 5.5.25, JDK 1.6.0_02, JSF RI 1.1_02 and RichFaces 3.1.0

                  • 6. Re: scrollableDataTable and commandLink
                    Ilya Shaikovsky Master

                    Ok I've changed my Env to
                    JSF RI Implementation-Version: 1.1_02-b08
                    No facelets
                    RF 3.1.1
                    Tomcat 5.5

                    And still have action fired with

                    <f:view>
                    
                    <h:form>
                     <rich:scrollableDataTable value="#{capitalsBean.capitals}" var="cap" width="200px" height="300px">
                     <rich:column>
                     <h:outputText value="#{cap.name}" />
                     </rich:column>
                     <rich:column>
                     <h:outputText value="#{cap.state}" />
                     </rich:column>
                     <rich:column>
                     <h:commandLink value="action" action="#{capitalsBean.action}"></h:commandLink>
                     </rich:column>
                     </rich:scrollableDataTable>
                     </h:form>
                     </f:view>


                    public String action() {
                     System.out.println("Action fired");
                     return null;
                     }
                    


                    • 7. Re: scrollableDataTable and commandLink
                      Ilya Shaikovsky Master

                      Probably need your full sample to reproduce.

                      • 8. Re: scrollableDataTable and commandLink
                        Alexandre Reis Newbie

                        http://alexeshadow.googlepages.com/tabela.zip

                        Page with the test case is home.jsp

                        WEB-INF/lib has been ommited to save space. If you wanna run the full app you'll need all hibernate libs, hibernate JPA, JSF and apache commons manager, and apache myfaces tomahawk.

                        • 9. Re: scrollableDataTable and commandLink
                          Alexandre Reis Newbie

                          Where can I get a 3.1.1 build so I can try this issue with the same config as yours?

                          • 11. Re: scrollableDataTable and commandLink
                            Ariel Fernando Newbie

                            I try 3.3.1 and same problem.... actionListener method is never called from a commandLink inside scrollableDataTable, and works fine fom a dataTable.

                            Richfaces 3.1.1
                            No facelts
                            Trinidad 1.03
                            Myfaces 1.1.5
                            Tomahawk 1.1.6
                            Tomcat 5.5.23

                            (I try others enviroments...Tomcat 6.0.14, JSF 1.2, Trinidad 1.2.2... with and without a4j-trinidad.jar... but no success).

                            This is my original post:
                            http://jboss.com/index.html?module=bb&op=viewtopic&t=119995

                            • 12. Re: scrollableDataTable and commandLink
                              Maksim Kaszynski Apprentice

                              arielfernando,
                              I'm still unable to reproduce the problem. I tried on both Myfaces 1.1.5 and RI 1.2.

                              can you provide source code of your action method?

                              • 13. Re: scrollableDataTable and commandLink
                                Ariel Fernando Newbie

                                Yes, sure!!!.

                                This is my complete "newCountry.jsp" file:


                                <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
                                pageEncoding="ISO-8859-1"%>
                                
                                <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
                                <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
                                <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
                                <%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh"%>
                                <%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr"%>
                                <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
                                <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
                                
                                <f:view>
                                <a4j:page>
                                <f:loadBundle basename="com.goytiapkg.econtroller.bundles.mensajes"
                                var="msg" />
                                <f:loadBundle basename="com.goytiapkg.econtroller.bundles.titles"
                                var="title" />
                                <f:loadBundle basename="com.goytiapkg.econtroller.bundles.forms"
                                var="tag" />
                                <tr:document title="#{title.applicationName}">
                                 <t:div styleClass="main">
                                 <f:subview id="idSubView">
                                 <t:saveState value="#{newCountry}" />
                                 <t:div styleClass="mainPanel">
                                 <rich:panel>
                                 <f:facet name="header">
                                 <h:outputText value="#{title.newCountry}" />
                                 </f:facet>
                                 <tr:panelBorderLayout>
                                 <f:facet name="left">
                                 <tr:form id="formCountry">
                                 <a4j:outputPanel id="idFormPanel">
                                 <tr:panelFormLayout>
                                 <tr:inputText id="idCodeName" label="#{tag.codeName}"
                                 value="#{newCountry.codeName}" required="true"
                                 requiredMessageDetail="{0} is required." columns="4"
                                 maximumLength="3" binding="#{newCountry.inputTextCodeName}">
                                 <tr:validateLength minimum="1" maximum="3" />
                                 </tr:inputText>
                                 <tr:inputText label="#{tag.countryName}"
                                 value="#{newCountry.name}"
                                 binding="#{newCountry.inputTextNombre}">
                                 </tr:inputText>
                                 <tr:panelButtonBar>
                                 <tr:commandButton id="idBtnSave" text="Save"
                                 actionListener="#{newCountry.save}" partialSubmit="true">
                                 <a4j:support event="onclick" reRender="idListaPaises" />
                                 </tr:commandButton>
                                 <tr:commandButton id="idBtnCancel" text="Cancel"
                                 actionListener="#{newCountry.cancelEditCountry}"
                                 partialSubmit="true"
                                 binding="#{newCountry.botonCancelEdition}" rendered="false"
                                 immediate="true" />
                                 </tr:panelButtonBar>
                                 </tr:panelFormLayout>
                                 </a4j:outputPanel>
                                 </tr:form>
                                
                                 </f:facet>
                                 <f:facet name="right">
                                 <h: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 value="Edit"
                                 actionListener="#{newCountry.editPais}"
                                 reRender=":idSubView:idFormPanel, :idSubView:prueba2"
                                 immediate="true">
                                 <a4j:actionparam name="idCountry" value="18" assignTo="#{newCountry.id}" />
                                 </a4j:commandLink>
                                 </rich:column>
                                 </rich:scrollableDataTable>
                                 </h:form>
                                 </f:facet>
                                 </tr:panelBorderLayout>
                                 <h:form id="formDataTable">
                                 <rich:dataTable id="idListaPaisesDataTable"
                                 value="#{pais.listPaises}"
                                 var="row2">
                                 <rich:column id="codeName2">
                                 <f:facet name="header">
                                 <h:outputText value="#{tag.countryName}" />
                                 </f:facet>
                                 <h:outputText value="#{row2.codeName}" />
                                 </rich:column>
                                 <rich:column id="nombre2">
                                 <f:facet name="header">
                                 <h:outputText value="#{tag.codeName}" />
                                 </f:facet>
                                 <h:outputText value="#{row2.nombre}" />
                                 </rich:column>
                                 <rich:column id="acciones2">
                                 <f:facet name="header">
                                 <h:outputText value="Action" />
                                 </f:facet>
                                 <tr:commandLink id="editTrinidad" text="Editar"
                                 immediate="true" partialSubmit="true"
                                 actionListener="#{newCountry.editPais}">
                                 <tr:setActionListener from="#{row2.id}"
                                 to="#{newCountry.id}" />
                                 </tr:commandLink>
                                 <a4j:commandLink value="Edit"
                                 actionListener="#{newCountry.editPais}"
                                 reRender=":idSubView:idFormPanel, :idSubView:prueba2"
                                 immediate="true">
                                 <a4j:actionparam name="idCountry" value="18" assignTo="#{newCountry.id}" />
                                 </a4j:commandLink>
                                 </rich:column>
                                 </rich:dataTable>
                                 </h:form>
                                 <h:outputText id="prueba2" value="#{newCountry.name}" />
                                 <t:div styleClass="mainPanelButtonBar">
                                 <rich:separator />
                                 <rich:spacer height="5px" />
                                 </t:div>
                                 </rich:panel>
                                 </t:div>
                                 </f:subview>
                                 </t:div>
                                </tr:document>
                                </a4j:page>
                                </f:view>
                                


                                And, action method ("editPais") source code:

                                 public void editPais(ActionEvent event) {
                                 System.out.print("***START EDITPAIS METHOD****");
                                 if(this.country.getId() >= 0) {
                                 this.inputTextCodeName.resetValue();
                                 this.inputTextNombre.resetValue();
                                 this.setCodeName("XXX");
                                 this.setName("THIS IS A TEST");
                                 this.botonCancelEdition.setRendered(true);
                                 }
                                 }
                                


                                You can see that I'm mixed some trinidad and richfaces components. All works so fine from dataTable, but nothing happend from scrollableDataTable. The only problem that I found when reRender is called from dataTable, is that trinidad components styles are broken. For example, labels font types, or input text...

                                Best regards,

                                Ariel.

                                • 14. Re: scrollableDataTable and commandLink
                                  Alexandre Reis Newbie

                                  Just tested the issue with Richfaces 3.1.1 and still having the same problem, Tomcat 5.5.25, JSF RI 1.1_02, Apache MyFaces tomahawk 1.1.6, Richfaces 3.1.1. Test project posted before

                                  1 2 Previous Next