4 Replies Latest reply on Nov 13, 2008 10:18 AM by hwoarang

    How to reRender only specific component with a4j:actionparam

    hwoarang

      Hi there!
      I'm not sure if this is fully related with a4j:actionparam, but...

      I have a modalPanel with a r:dataTable.

      Each row has a h:commandLink to select the record row, hide the modalPanel and update two h:inputTexts in the main form (panel caller) with data from the row selected.

      Its working, except that all other components in the main form are reRendering too, leaving them all empty.

      Please, how to update only the two components assigned to the a4j:actionparam ??

      I'm using:
      RichFaces 3.2.2
      Facelets 1.1.14
      JSF 1.2

      thank you in advance!

      the h:commandLink (inside modalPanel - template.jspx):

      <h:commandLink
       onclick="Richfaces.hideModalPanel('mymodal');"
       style="text-decoration: none; border: none">
       <a4j:actionparam
       name="paramSigla"
       value="#{item.sigla}"
       assignTo="#{ManterPessoa.pessoa.localizacao.sigla}" />
       <a4j:actionparam
       name="paramDesc"
       value="#{item.descricao}"
       assignTo="#{ManterPessoa.pessoa.localizacao.descricao}" />
       <h:graphicImage
       value="/imagens/selecionar.gif"
       style="text-decoration: none; border: none"
       title="selecionar registro" />
      </h:commandLink>


      the code the call my modalPanel (from main form):
      <a4j:commandButton
       value="..."
       immediate="false"
       onclick="Richfaces.showModalPanel('mymodal'); return false;" />
      


        • 1. Re: How to reRender only specific component with a4j:actionp
          hwoarang

          I noticed that after closing the modalPanel, my page is been submited... after that, the others became empty.

          I'm not sure if the reason is the a4j:commandButtom onclick or the h:commandLink.

          any help?

          • 2. Re: How to reRender only specific component with a4j:actionp
            hwoarang

            Ok.
            There's nothing to do with a4j:actionparam... at least removing it from my modal, I have the same problem.

            The problem is that my main form get submitted after hiding the modalPanel, using h:commandLink or h:commandButtom... and after that submiting my bean's properties get a reset (dont know why), leaving all fields empty.

            Anybody has a clue about this problem?

            Thank you.

            • 3. Re: How to reRender only specific component with a4j:actionp
              ilya_shaikovsky

              1) you use h:commandLink in your modal. This standard component works just as it should. It performs normal submit with full page reloading. use a4j:commandLink and reRender the components you need. panel closure should be done in oncomplete.

              2) Why did you calling the modal panel with a4j:control? Do you really need ajax request there?(may be just outputLink?) And whet is more strange - do you really need ajax request fired after the modal has been shown? (maybe shown the modal in oncomplete?)

              3) have you read about forms usage with modal panel limitations in our documentation?

              • 4. Re: How to reRender only specific component with a4j:actionp
                hwoarang

                Hi ilya!

                thank you for your comments..

                1) works like a charm ! thank you !! I was too tired to think in this "angle", I think... :p

                2) in fact, I tried so many different ways, that when I put the code here, its comes with a4j:commandButtom, but the problem was in the hideModalPanel...

                3) yes... my modal has an internal form for its own components, but it is not inside another form (nested forms)

                Ilya, thank you one more time!