How to display a please wait message when the server is processing using addBusyStateListener in ADF ? https://cedricleruth.com/how-to-display-a-please-wait-message-when-the-server-is-processing-using-addbusystatelistener-in-adf/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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').nextSibling.id); | |
//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 | |
evt.preventUserInput(); | |
} 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 | |
popup.show(); | |
} else { | |
//Processing is done so we can close the popup | |
popup.hide(); | |
//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