1 Reply Latest reply on Nov 7, 2011 7:34 AM by julez

    a4j:commandButton's oncomplete does not wait for a4j:param

    julez

      Hello,

       

      I have for each row inside a rich:dataTable an a4j:commandButton to show a popupPanel, which works so far.

      Now I want the commandButton also to change the content of the popupPanel, according to the row in which the commandButton sits. Passing a param value with a4j:param works, but the panel gets always rendered BEFORE the param is passed.

       

      My source for the commandButton looks like the following:

       

      <a4j:commandButton value="(PSM in cluster)"

           render="popup_content"

           execute="@this"

           oncomplete="#{rich:component('popup_panel')}.show(); return false;">

           <a4j:param assignTo="#{cc.attrs.psmViewerBean.popupData}" value="#{psmRow.id}" />

      </a4j:commandButton>

       

      The popupPanel is outside every form at the end of the document.

      The psmRow is the iterating element of the dataTable and its ID gets passed to a function of the backing bean.

      The popup_content is a a4j:outputPanel inside the popupPanel which is bound via binding to a bean component, which should also update the content and does, but, as said, always after the rendering, so it is shown always on the next click.

       

      Any ideas how I could pass any relevent row parameter and then render the popupPanel?

       

      Tanks,

      Julian

        • 1. Re: a4j:commandButton's oncomplete does not wait for a4j:param
          julez

          After trying out several things I found a workaround with a jsFunction. My code now looks like this, it unfortunately loads the popupPanel twice, but that's ok for now.

           

          I set the data via the jsFunction:

           

          <a4j:jsFunction name="updatePopup" render="popup_panel">

               <a4j:param name="id" assignTo="#{cc.attrs.psmViewerBean.popupData}"/>

          </a4j:jsFunction>

           

          And the buttons call the jsFunction via the onclick

           

          <a4j:commandButton value="buttontext"

                              render="popup_panel"

                              execute="@this"

                              onclick="updatePopup(#{psmRow.id});"

                              oncomplete="#{rich:component('popup_panel')}.show(); return false;"/>