3 Replies Latest reply on Jun 3, 2007 5:28 PM by Rados?aw Kosicki

    s:link/s:button in RichFaces or Trinidad

    Philipp Straub Newbie

      Hi all,

      I have a table with a button in each row to open the details.

      <t:dataTable value="#{listManager.dataModel}" var="item" rowIndexVar="idx">
       ...
       <h:column>
       <f:facet name="header">
       <h:outputText value="Details" />
       </f:facet>
       <s:button action="#{itemManager.selectItem}" value="Details">
       <f:param name="listidx" value="#{idx}" />
       </s:button>
       </h:column>
      </t:dataTable>
      


      When I click the button, I can get parameter listidx with:

      @RequestParameter("listidx")
      private String idx;
      


      When I'm trying to do this with RichFaces or Trinidad this doesn't work. The injected RequestParameter always is null.

      Here the code for the tables:

      <tr:table value="#{listManager.dataModel}" var="item" rows="5" rowIndexVar="idx">
      ...
       <tr:column>
       <f:facet name="header">
       Details
       </f:facet>
       <s:button action="#{itemManager.selectItem}" value="Details">
       <f:param name="listidx" value="#{idx}" />
       </s:button>
       </tr:column>
      </tr:table>
      
      
      <rich:dataTable value="#{listManager.dataModel}" var="item" rowIndexVar="idx">
      ...
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Details"></h:outputText>
       </f:facet>
       <s:button action="#{laufManager.selectItem}" value="Details">
       <f:param name="listidx" value="#{idx}" />
       </s:button>
       </rich:column>
      </rich:dataTable>
      


      Is there something I'm doing wrong? Or are s:link and s:button simply not working with Richfaces and Trinidad?

      Thanks in advance!

        • 1. Re: s:link/s:button in RichFaces or Trinidad
          Pete Muir Master

          There is now rowIndexVar attribute on rich:dataTable or tr:table.

          • 2. Re: s:link/s:button in RichFaces or Trinidad
            Philipp Straub Newbie

            Oh, and I had specially added columns to my tables (#{idx+1}) to check if rowIndexVar worked, but didn't notice that every row was 1.

            Thanks for helping a blind man ;-)

            • 3. Re: s:link/s:button in RichFaces or Trinidad
              Rados?aw Kosicki Newbie

              I have similar problem I canot invoke any action="#{Bean.action}" when I'am trining to use RichFaces

              i trided to use <t:commandLink, <a4j:commandLink, <s:commandLink, <s:link any of them cannot invoke actions from bean :-/. The code is loking like that

              <rich:dataTable id="adressList" rows="10" columnClasses="col" var="adressele" value="#{adressesList}" rendered="#{not empty adressesList}">
              <f:facet name="header">
              <rich:columnGroup>
              <h:column> <h:outputText styleClass="headerText" value="#{messages.name}"/> </h:column>
              <h:column> <h:outputText styleClass="headerText" value="#{messages.url}"/> </h:column>
              <h:column> <h:outputText styleClass="headerText" value="#{messages.updatefrequency}"/> </h:column>
              <h:column> </h:column>
              <h:column> </h:column>
              </rich:columnGroup>
              </f:facet>

              <h:column>
              <h:commandLink value="#{adressele.name}" action="#{Adress.selectAdressAction}">
              <t:updateActionListener property="#{Adress.adress}" value="#{adressele}"/>
              </h:commandLink>
              </h:column>
              <h:column> <h:outputText value="#{adressele.url}"/> </h:column>
              <h:column> <h:outputText value="#{messages.updatefrequency}"/> </h:column>
              <h:column> <h:commandButton type="submit" value="#{messages.delete}" action="#{Adress.deleteAdressAction}"/> </h:column>
              <h:column>
              <h:commandButton type="submit" value="#{messages.show_value}" action="#{Adress.walkThroughStepsShowValueAction}">
              </h:commandButton>
              </h:column>
              </rich:dataTable>
              <rich:datascroller for="adressList" maxPages="10" />