3 Replies Latest reply on May 22, 2011 4:11 AM by coenos

    how to pass a parameter to a ModalPanel

    coenos

      Hi,


      I have a ModalPanel that I want to populate based on a product ID. I have the following code to call the ModalPanel.



      <a:commandLink value="ProductDetails22" oncomplete="#{rich:component('mp')}.show()"
           action="#{prodSelCon.setProductId(product.id)}">
           <a:actionparam name="productId" value="#{product.id}"assignTo="#{prodSelCon.productId}" />
      </a:commandLink>



      I can't get the value of the parameter to work because the ModalPanel is rendered before the parameter productId is even set, so it is always 0! As seen, I have tried it with onComplete(), onClick , an actionParam etc. Nothing works, so far.


      How can this be done? Thanks for your help,
      Coenos

        • 1. Re: how to pass a parameter to a ModalPanel
          lvdberg

          Hi Coen,


          maybe I donn't understand what you're trying to do, but the commandLink action calls the method which sets the product id and after that it calls the open script. The additional action param shouldn't be necessary in this case, or am I missing something.


          Leo

          • 2. Re: how to pass a parameter to a ModalPanel
            imion2k5

            Hi Coen,


            try to add the reRender attribute to your commandLink:


            reRender="yourModelPanelId"



            Then open the modalPanel in the onComplete method. The panel should be rendered after the parameter is set. Leo is right, the actionparam isn't necessary.


            Björn

            • 3. Re: how to pass a parameter to a ModalPanel
              coenos

              Hi Bjorn,


              rerendering indeed does the trick ! thanks!


              I knew that the actionParam was another approach, but I got that from an example, so I just kept it there so you'd see the entire call I created.


              Cheers,
              Coen