5 Replies Latest reply on Mar 3, 2011 5:16 AM by Kike Gil

    componentControl & popupPanel & a4j:ajax

    Kike Gil Novice

      I have a h:commandLink

      1. when i click it, the link must call to a function of my java class(Bean) with a4j:ajax

      2. but also it must call to rich:popupPanel with componentControl, and the request of the first point print in the popup

       

      The problem is to use

       

      <h:commandLink value="Execute Function">

           <rich:componetControl target="popup" operation="show"/>

           <a4j:ajax execute="@form" render="@form form1" event="click" listener="#{nameBean.function}"/>

      </h:commandLink>

       

      it doesn't work. Is there some method for call to bean and later open the popup???

        • 1. componentControl & popupPanel & a4j:ajax
          Kike Gil Novice

          I resolved my problem, if someone need the same this code perfectly work.

           

          <a4j:commandLink ajaxSingle="true" value="ver Recetas">       

           

           

           

           

           

           

           

           

           

           

           

           

           

               <a4j:ajax execute="@form" render="@form form1" event="click" listener="#{bean.seeItems}" oncomplete="#{rich:component

                   ('popupItems)}.show()" />
          </a4j:commandLink>

          <rich:popupPanel id="'popupItems" modal="true" resizeable="false" movable="true" autosized="true" width="800">

                   <f:facet name="header">

                          <h:outputText value="ITEMS"/>

                      </f:facet>

                       <f:facet name="controls">

                          <h:outputLink value="#" onclick="#{rich:component('popupItems)}.hide();return false;" styleClass="link1">

                           X

                          </h:outputLink>

                      </f:facet>

                      <h:outputText value="#{bean.items.get(0).name}"/>

          </rich:popupPanel>

          I don't know if it is correct, but it works very good

          • 2. componentControl & popupPanel & a4j:ajax
            Ilya Shaikovsky Master

            1) not worked because event should be "action"

             

            2) not needed to place ajax into links because you could just specify all the attributes at link (it's already has ajax behavior attached.)

            • 3. componentControl & popupPanel & a4j:ajax
              Kike Gil Novice

              then, i don't know why works with my last writed code.

              One example please?

              • 4. componentControl & popupPanel & a4j:ajax
                Ilya Shaikovsky Master

                i'm not saying it shouldn't works.. actually it should just telling that it's not needed to plug ajax behavior to the component which already provides the same ajax and options (inner just redefines built-in)

                 

                so most clean usage for me is:

                 

                <a4j:commandLink value="ver Recetas" execute="@form" render="@form form1" oncomplete="#{rich:component('popupItems)}.show()"

                actionListener="#{bean.seeItems}"/>      

                 

                P.S. not ajaxSingle not supported as now execute specifies processing options.

                • 5. componentControl & popupPanel & a4j:ajax
                  Kike Gil Novice

                  Thaks, it works perfectly with your code