Monday, May 13, 2013

hide or show popup programmatically in oracle adf?

In the managed bean add the following code

public void methodOne() {
        showPopup(editPopup, "p1");
}

// Code to show the popup
// It takes popup ID as the parameter
public static void showPopup(RichPopup popup, String popID) {
         FacesContext context = FacesContext.getCurrentInstance();
         StringBuilder script = new StringBuilder();
         script.append("var popup = AdfPage.PAGE.findComponent('").append(popID).append("'); ")
                 .append("if (!popup.isPopupVisible()) { ")
                 .append("var hints = {}; ");

           script.append("popup.show(hints);}");
           ExtendedRenderKitService erks =
             Service.getService(context.getRenderKit(), ExtendedRenderKitService.class);
           erks.addScript(context, script.toString());
}


1 comment:

  1. import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
    import org.apache.myfaces.trinidad.util.Service;

    ReplyDelete