Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to display a please wait message when the server is processing using addBusyStateListener in ADF ?
var popup = null;
var clickedElem = null;
function triggerOnLoad(event) {
//You can either set the popup using the pure html div id (recommended)
popup = AdfPage.PAGE.findComponentByAbsoluteId(document.getElementById('loaderId');
//or set the popup knowing the full id of your popup for example :
//popup = AdfPage.PAGE.findComponentByAbsoluteId('p1:processingP');
//popup = AdfPage.PAGE.findComponent('processingP');
return true;
function warnAndPreventUserInput(evt) {
//To avoid most mistake where addBusyStateListener and removeBusyStateListener don't have the same arguments
//You can set the element to listen for the application busy state to be the one the user just clicked :
clickedElem = evt.getSource();
if (popup != null) {
//Adds a listener to call the handleBusyState function whenever there is a busy state event.
AdfPage.PAGE.addBusyStateListener(clickedElem, handleBusyState);
//Don't authorize the user to interact with ADF while it's busy
} else {
console.error('The processing pop up isnt defined on this page ');
//JavaScript call back handler
function handleBusyState(evt) {
if (popup != null) {
if (evt.isBusy()) {
//Processing in progress so we display the popup;
} else {
//Processing is done so we can close the popup
//Important : We remove the listener from the clicked object so it will
//stop looking for a busy event to display the popup
AdfPage.PAGE.removeBusyStateListener(clickedElem, handleBusyState);
} else {
console.error('The processing pop up isnt defined on this page ');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment