0 Replies Latest reply on Sep 29, 2010 10:44 AM by Manish Bhatia

    Issue with a4j:support on a h:selectOneMenu within a DataTable

    Manish Bhatia Newbie

      I have a h:selectOneMenu as part of a DataTable. As a user selects an item in the drop down. I have some business logic to process, and depending on the result of the logic, it will add or delete a record from the table.

      If there is a delete, users want to see a confirmation message.

       

      So this is what I have done

       

      <h:selectOneMenu id="results" value="#{mpa.actionResults}">
                   <a4j:support event="onchange" action="#{commonOperation.processRecords}"
                           oncomplete="#{maDeleteResult ? 'openModalWindow(\'modalCommonConfirmPanel\')' : ''}; "
                           reRender="hraProcessing" ajaxSingle="true" />
                    <s:selectItems value="#{mpa.validActionResults}" var="ar"
                           label="#{ar.name}" noSelectionLabel="Select One" />
                    <s:convertEntity />
      </h:selectOneMenu>

       

      The action on a4j:support tag, processes the change, and sets maDeleteResult flag. "oncomplete", checks for the flag and condtionally displays a modal pop-up.

      (reRender="hraProcessing" is the id of the table)

       

      This works perfectly fine if h:selectOneMenu is by itself. But if it is part of a DataTable it does not.

      In "oncomplete" gets evaluated even before the action is called, and I am not able to dislpay the popup correctly.

       

      Is this a correct approach ? If annyone knows a better way to do this, would really appreciate it.

       

      Thanks