Wednesday, May 5, 2010
How to Auto refresh a page in OAF?
Step 1:
Open the CO of any region in the page that need to be refreshed.
Step 2:
In the CO write the following code to put a javascript on the page.
String onLoadFunction = "\n function onLoadFunction (refTime){ " +
"\n setTimeout(\"location.reload(true);\",refTime);" +
"\n } " ;
pageContext.putJavaScriptFunction("onLoadFunction",onLoadFunction);
Step 3:
Now, in the same CO use following code to get the root web bean of the page
OABodyBean rtBodyBean = (OABodyBean) pageContext.getRootWebBean();
Do not forget to import oracle.apps.fnd.framework.webui.beans.OABodyBean;
Step 4:
Now, call setOnload on the bodybean to call the javascript function created in step 1 every time body of the page is loaded.
rtBodyBean .setOnLoad("JavaScript:onLoadFunction(5000)");
5000 in above code is in milliseconds. So above code will refresh the page every 5 seconds.
This code is tried and tested.
Post a comment if you face any issue.
Thanks,
Manish
Subscribe to:
Posts (Atom)