3 Replies Latest reply on Aug 10, 2009 12:17 PM by bm97

    f:setPropertyActionListener doesn't work when ajaxSingle in

      The problems:

      a) With ajaxSingle="true" on a commandButton in a rich:dataTable the f:setPropertyActionListener don't work. No setters were accessed - see the console log, when you try out the code. Why?

      b) With ajaxSingle="false": When you click on the "Edit" buttons sometimes the the setters are called, sometimes not. Or the outpanel shows the old previous data, but this doesn't seam to be a reRender issue. In this case a4j:outputPanel with ajaxRendered="true" is used.

      Thank you for your help/hints.

      See these simplified code snippets

      xhtml:

       <!-- Show data from session based dataholder -->
       <a4j:outputPanel ajaxRendered="true">
       <ul>
       <li>#{testDataHolder.foo}</li>
       <li>#{testDataHolder.bar}</li>
       </ul>
       </a4j:outputPanel>
      
       <!--datatable -->
       <a4j:form >
       <rich:dataTable
       value ="#{tableManager.model}"
       binding ="#{tableManager.dataTable}"
       var ="dataItem"
       rows ="10"
       >
       <rich:column>
       <h:outputText value="#{dataItem}" />
      
       <!-- Click on the button to set data to dataholder -->
       <a4j:commandButton
       XXX_ajaxSingle="true"
       value="Edit"
       >
       <f:setPropertyActionListener
       value="#{dataItem}"
       target="#{testDataHolder.foo}"
       />
       <f:setPropertyActionListener
       value="#{dataItem}"
       target="#{testDataHolder.bar}" />
       </a4j:commandButton>
      
       </rich:column>
       </rich:dataTable>
       </a4j:form>


      Spring:
       <bean id="testDataHolder" class="com.test.TestDataHolder" scope="session"/>
      


      Backing-bean:
      package com.test;
      
      import org.apache.commons.logging.Log;
      import org.apache.commons.logging.LogFactory;
      
      public class TestDataHolder {
      
       private Object foo;
       private Object bar;
       private static final Log LOG = LogFactory.getLog(TestDataHolder.class);
       public Object getBar() {
       LOG.error(String.format("getBar %s", bar));
       return bar;
       }
       public Object getFoo() {
       LOG.error(String.format("getFoo %s", foo));
       return foo;
       }
       public void setBar(final Object theBar) {
       LOG.error(String.format("setBar %s", theBar));
       bar = theBar;
       }
       public void setFoo(final Object theFoo) {
       LOG.error(String.format("setFoo %s", theFoo));
       foo = theFoo;
       }
      }