5 Replies Latest reply: Mar 9, 2010 10:10 AM by 758937 RSS

    ADF load popup on startup

    650092
      Hi,
      I am using adf and the af:popup, and I am trying to show the popup after the page is rendered.
      But I don't know how to do this.

      Is there anyone who knows how to process ?
        • 1. Re: ADF load popup on startup
          Frank Nimphius-Oracle
          Hi,

          ut a clientListener below the document element on the page and set the type to "load". Then add a JavaScript function to the page as follows

          function openPopup(evt){
          var popup = AdfPage.PAGE.findComponent("popupId");
          popup.show();
          }

          Frank
          • 2. Re: ADF load popup on startup
            650092
            Hi Frank,

            I made this :

            <f:view>
            <af:document maximized="true">
            <af:clientListener type="load" method="openPopup"/>
            <af:group>
            <![CDATA[
            <script>
            /**
            * Show the popup
            */
            function openPopup(event)
            {
            var popup = AdfPage.PAGE.findComponent("popup");
            popup.show();
            }
            </script>
            ]]>
            </af:group>
            <af:form>
            <af:panelGroupLayout>
            <af:popup id="popup">
            <af:panelGroupLayout layout="vertical">
            <af:outputText value="Some"/>
            <af:outputText value="popup"/>
            <af:outputText value="content"/>
            </af:panelGroupLayout>
            </af:popup>
            </af:panelGroupLayout>
            </af:form>
            </af:document>
            </f:view>

            But the AdfPage.PAGE.findComponent(popup) returns "undefined".

            Do you know why ?

            Anthony
            • 3. Re: ADF load popup on startup
              Don Kleppinger
              Try this example where I hide a popup from the ok button to prevent an ajax call

              function aboutOkButton(event) {
              var dialog = event.getSource();
              var popup = dialog.findComponent("aboutPopup");
              popup.hide();
              event.cancel();
              }

              To hide/show a popup from a backing bean Use this

              public void closePopup(String popupId) {
              ExtendedRenderKitService erkService =
              Service.getService(getFacesContext().getRenderKit(),
              ExtendedRenderKitService.class);
              erkService.addScript(getFacesContext(),
              "AdfPage.PAGE.findComponent('" + popupId +
              "').hide();");
              }

              public void showPopup(String popupId) {
              ExtendedRenderKitService erkService =
              Service.getService(getFacesContext().getRenderKit(),
              ExtendedRenderKitService.class);
              erkService.addScript(getFacesContext(),
              "var hints = {autodismissNever:true}; " +
              "AdfPage.PAGE.findComponent('" + popupId +
              "').show(hints);");
              }



              If the popup is not under the root you need to put a qualified name

              i.e.
              var popup = AdfPage.PAGE.findComponent("myTemplate:myPopup");

              If you have the component binding of the popup in a backing bean. You can walk up the parent tree to find the context ID
              • 4. Re: ADF load popup on startup
                650092
                Hi,

                Thank you for your help.
                It works very fine.

                Anthony
                • 5. Re: ADF load popup on startup
                  758937
                  Buen Aporte, gracias.
                  Efrain.