Requirement is to refresh the parent window page to reflect the changes after closing the popup window page.
1. Put a javascript function on popup window page's body bean in process request to send the refresh event back to parent window page.
OABodyBean bodyBean = (OABodyBean)pageContext.getRootWebBean();
pageContext.putJavaScriptFunction("refreshParent", "function refreshParent() { opener.submitForm('DefaultFormName',1,{'actionEvent':'REFRESH_PARENT'}); window.close(); }");
OAButtonBean bean = (OAButtonBean)webBean.findChildRecursive("closeBtn");
if (bean != null) {
bean.setOnClick("javascript:refreshParent()");
}
2. Consume the refresh event in the main/parent window page process form request and remove the event parameter
if("REFRESH_PARENT".equals(pageContext.getRenderingContext().getServletRequest().getParameter("actionEvent")))
{
pageContext.removeParameter("actionEvent");
doSearch(pageContext, webBean); // This is a method to get the input parameters and execute view object along with where conditions
}
No comments:
Post a Comment