Programatically hide and show popup in ADF 11g
/**
* Show popup.
*/
import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
import org.apache.myfaces.trinidad.util.Service;
public static void showPopup(UIComponent pId) {
String popupId= (String )pId.getClientId(getFacesContext());
FacesContext context = null;
ExtendedRenderKitService extRenderKitSrvc = null;
StringBuilder script = new StringBuilder();
context = FacesContext.getCurrentInstance();
extRenderKitSrvc = Service.getRenderKitService(context, ExtendedRenderKitService.class);
script.append("var popup = AdfPage.PAGE.findComponent('").append(popupId).append("'); ").append("popup.show();");
extRenderKitSrvc.addScript(context, script.toString());
}
/**
* Hide popup.
*/
public static void hidePopup(UIComponent pId) {
String popupId= (String )pId.getClientId(getFacesContext());
FacesContext context = FacesContext.getCurrentInstance();
ExtendedRenderKitService erkService = Service.getService(context.getRenderKit(), ExtendedRenderKitService.class);
erkService.addScript(context,"AdfPage.PAGE.findComponent('" + popupId + "').hide();");
}
No comments:
Post a Comment