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

    filterMethod and action (precedence)

    hwoarang

      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" />
              </a4j:htmlCommandLink>
          </f:facet>
      </r:column>
      

       

      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.

       

      Flávio    

        • 1. Re: filterMethod and action (precedence)
          ilya_shaikovsky

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

           

          LOg

           

          filterMethod

          ....

          action method

          ...

          filterMethod for new filter values.

          • 2. Re: filterMethod and action (precedence)
            hwoarang

            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}" />
                        </a4j:commandLink>
                    </a4j:outputPanel>
                </f:facet>
            </r:column>
            

             

            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.

             

            Flávio     

            • 3. Re: filterMethod and action (precedence)
              hwoarang

              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.

               

              Flávio