1 Reply Latest reply on Aug 21, 2007 6:35 PM by Pete Muir

    Problem with a4j reRender and s:button disabled property

    Markus Dahm Novice

      Hi,

      I've got a search page with some select boxes and a search button.
      Upon a search the data model list is filled and a series of action buttons below
      is enabled or disabled depending on the values that have been
      selected in the h:selectOneMenu lists.

      So far so good. I wanted to automate this by rerendering the result list
      and the buttons every time the user selects another entry:


      <h:selectOneMenu value="#{arztAbrechnung.krankenhaus}" id="krankenhaus">
      <s:selectItems value="#{arztAbrechnung.krankenhausData}" var="krankenhaus" label="#{krankenhaus.name}" id="krankenhausItems" />
      <a4j:support eventsQueue="queue" requestDelay="100" event="onchange" action="#{arztAbrechnung.suche}" reRender="leistungen,excelExport"/>

      <s:convertEntity />
      </h:selectOneMenu>


      Some where below there is the data table and the button:


      <t:dataTable var="l" value="#{leistungenSuche}" rows="10" rowClasses="odd-row, even-row" id="leistungen"
      renderedIfEmpty="false"
      sortable="true"
      sortColumn="#{arztAbrechnung.sortColumn}"
      sortAscending="#{arztAbrechnung.sortAscending}"
      preserveDataModel="false"
      preserveSort="true"
      >
      ....

      <s:button id="excelExport" target="contentWindow" view="/content/data" value="Export Arzt-Abrechnung"
      rendered="#{leistungenSuche.rowCount > 0}" disabled="#{not arztAbrechnung.arztAbrechnung}">
      <f:param name="dataId" value="exportExcelArztAbrechnung"/>
      </s:button>


      Alas, this does not work correctly. When I choose an item in the select list, the result list and the button are indeed rerendered. However, I can not click the button since as the source code of the page reveals, the button's property "disabled" is still set (to the value "disabled").

      I'm not sure whether this due to Seam or A4JSF. I tried with the latest version 1.1.1 of A4J. How can I make sure the disabled flag is also reset?
      It depends on a query to the bean which in turn takes a look at the selected values. May there be some problem in the order in which everything gets executed?

      Cheers
      Markus

      P.S. The button is *rerendered* correctly, i.e. it is not gray anymore, but not clickable