3 Replies Latest reply on Jun 25, 2010 1:42 PM by Flavio Henrique

    filterMethod and action (precedence)

    Flavio Henrique Newbie

      Hi there!

      I have this code:


      <r:column width="1%" style="text-align:center;" filterMethod="#{MyBean.filterMedia}">
          <f:facet name="header">
              <a4j:htmlCommandLink action="#{MyBean.toggleLock}">
                  <h:graphicImage value="/imagens/lock.png" id="lockImage" />


      My question is: how to trigger the action event (MyBean.toggleLock) before the filterMethod (MyBean.filterMedia) ???

      The filterMethod depends the business logic from action event (MyBean.toggleLock), but filterMethod is called first.


      Any suggestions?


      Thank you.



        • 1. Re: filterMethod and action (precedence)
          Ilya Shaikovsky Master

          filterMethod - will be called at decode phase and at render phase. and action method at invoke application so the sequence will be like






          action method


          filterMethod for new filter values.

          • 2. Re: filterMethod and action (precedence)
            Flavio Henrique Newbie

            Hi Ilya! Thank you.


            I've found a "way" to toggle action before filterMethod, and trigger filterMethod only once (at render phase):



            <r:column filterMethod="#{ManterCertificado.filterMidia}">
                <f:facet name="header">
                    <a4j:outputPanel id="gallery">
                        <a4j:commandLink oncomplete="reRenderTable();" ignoreDupResponses="true">
                            <h:graphicImage value="/imagens/lock.png" id="lockImage2" title="Filtrar mídias bloqueadas" styleClass="imagens" />
                            <a4j:actionparam value="lock" assignTo="#{ManterCertificado.midiaFilter}" actionListener="#{ManterCertificado.toggleMidiaFilter}" />


            It is too much!?

            The actionparam's actionListener is called first, then filterMethod.

            I dont know is why filterMethod is called only once (in render phase).


            In fact, why filterMethod is called twice ? Why only render phase isn't enough?


            Thank you.



            • 3. Re: filterMethod and action (precedence)
              Flavio Henrique Newbie

              I meant:


              What I don't know is what I did to make filterMethod to be called only once, in render phase. But is ok to me... in fact I'm wondering why normal filterMethod need bo be called twice.


              Sorry the spam.