4 Replies Latest reply on Jun 13, 2011 9:00 AM by Chuck Grohowski

    Problem accessing f:param in dataTable onRowClick event

    Chuck Grohowski Newbie

      Hello,

       

      I am having trouble getting a parameter passed using a4j:support on a rich:dataTable.  It is not seeing the parameter when it's part of the value from which the dataTable is being generated. I have looked through other examples and discussions on here and I cannot seem to figure out what I am doing wrong. 

       

      Here is the code:

       

       

          <rich:dataTable onRowMouseOver="this.style.backgroundColor='#F1F1F1'"

                                    onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" cellpadding="0" cellspacing="0"                               width="773" border="0" var="hist" value="#{idsController.messageHistory}" rowKeyVar="keyVar"                               rowClasses="idsRow" columns="1">

                      <rich:column>

                          <h:outputText value="#{hist.label} - #{keyVar} #{hist.index}" styleClass="boldText"/>

                      </rich:column>

       

                      <a4j:support actionListener="#{idsController.displayMessage}" event="onRowClick" immediate="true">

                          <f:param name="theIndex" value="#{hist.index}"/>

                      </a4j:support>

          </rich:dataTable>

                     

       

       

      And here is the backing bean method:

       

       

          public void displayMessage( ActionEvent e ) {

             

              Map<String, Object> attrs = e.getComponent().getAttributes();

              for( String k : attrs.keySet() ) {

                  logger.debug( k + " = " + attrs.get( k ) );

              }

          }

       

       

      #{idsController.messageHistory} is an ArrayList and the table is rendered properly with all of the proper elements included.  The list elements contain a property named index.  The actionListener is called but the parameter is never passed to the method properly.  I tried adding ajaxSingle to the a4j:support but that complained and did not work properly.  I also tried immediate="true" as well as using <f:attribute> instead of <f:param>. If I try this:

       

      <f:param name="test" value="value"/>

       

      The value "value" for element "test" is displayed correctly in my debug logs, so it's working, just not for the dynamic elements I need.

       

      The parameter is passed correctly, so my issue has to be with the list of items.  Anyone have any suggestions?  My environment is RF 3.3.3 / JDK1.5 / Weblogic 10.0 MP1.

       

      Many thanks,

       

      Chuck