3 Replies Latest reply on Oct 13, 2008 3:37 PM by hemantmahidhara

    reRender called before actionListener

    hemantmahidhara

      I have an a4j:commandLink with an actionListener and a reRender property specified. The reRender property re-renders a rich:panel on the same page. The expected behaviour is that the actionListener gets called and then the reRender happens.

      When the rich:panel has a rich:dataTable in it, this behaviour changes. The reRender gets called before the actionListener. If instead of the rich:dataTable I have simple h:outputText elements, the actionListener gets called follwed by the reRender.

      The idea here is that the actionListener should set uniqueID in the session and the displayBean should use it when reRender is called. But this logic fails if the reRender gets called before actionListener.

      Any help? Here is my code

      <h:panelGrid columns="1" border="1">
       <a4j:commandLink
       actionListener="#{testBean.actionListener}" immediate="true" reRender="detailsPanel">
       <h:outputText value="ID - 1221505577551"/>
       <h:outputText id="uniqueID" value="1221505577551" style="display:none" />
      
       <rich:panel id="detailsPanel" style="border:1px solid gray">
      
       <h:outputText value="#{displayBean.uniqueID}"></h:outputText>
       <rich:dataTable value="#{displayBean.multiples}">
       </rich:dataTable>
       </rich:panel>
       </h:panelGrid>
      


        • 1. Re: reRender called before actionListener
          ilya_shaikovsky

          It's impossible that reRender is called after actionListener.. Because reRender is a client side JS operation which takes place after responce returned to the client(after all the phases on server side finished) :)

          Seems you meant something else? Probably you means that some wrong data fetched? Describe please more presice the case.

          • 2. Re: reRender called before actionListener
            hemantmahidhara

            Scenario 1: detailsPanel only has h:outputText elements in it that get data from the displayBean.
            When I click on the a4j:commandLink the actionListener gets called on the bean. Then the reRender gets called (i am assuming), instantiates the displayBean and populates the detailsPanel. -- this is correct behaviour.

            Scenario 2: detailsPanel has a rich:dataTable in it that gets data from the displayBean.
            When I click on the a4j:commandLink, first the displayBean gets instantiated, populates the displayPanel and then the actionListener gets called on the bean. -- this is problematic behaviour

            • 3. Re: reRender called before actionListener
              hemantmahidhara

              Let me try to explain again:

              Scenario 1: detailsPanel only has h:outputText elements in it that get data from the displayBean.
              When I click on the a4j:commandLink the actionListener gets called on the testBean. Then the reRender gets called (i am assuming), instantiates the displayBean and populates the detailsPanel. -- this is correct behaviour.

              Scenario 2: detailsPanel has a rich:dataTable in it that gets data from the displayBean.
              When I click on the a4j:commandLink, first the displayBean gets instantiated, populates the displayPanel and then the actionListener gets called on the testBean. -- this is problematic behaviour