apex.util.showSpinner() Example

Do you want to show Oracle Apex Spinner while performing a task? Mostly we required to show some processing status when we call some Ajax Callback application process or executing a database procedure in the background and we want to give some indicator to the end-user that something is processing in behind so that he can wait. Here in this tutorial, I am giving an example of apex.util.showSpinner() JavaScript function to show the spinner in Oracle Apex. Below is the screenshot of Apex spinner in Mac (in windows it is little different):

apex.util.showSpinner Example

Oracle Apex - apex.util.showSpinner Example

Suppose you are calling an Ajax Callback process on page load, which takes around 4 to 5 seconds time to process and you want to show the Apex spinner while its process completes. To achieve this goal, follow these steps:

1. Specify Static ID for a Region

In your page in Apex, specify a static id to a region in which you want to show the spinner. To do this, go to Page properties > Advanced > Static ID. As shown in the below image:

Oracle Apex region with static id.

2.  Add JavaScript for Page Load

Now add JavaScript code to execute on page load, go to Page > JavaScript > Executes when page load and add the following JavaScript code, also shown in the below image:

var lSpinner$, lPromise;
apex.util.delayLinger.start( "main", function() {
    lSpinner$ = apex.util.showSpinner( $( "#ofcdetails" ) );
} );

setTimeout(
    function() {
      lSpinner$.remove();
    }, 5000);

Oracle Apex - JavaScript code on page load.

Please notice in the above JavaScript code that static region id "ofcdetails" is used.

Now save the changes and run the page to test.

Related tutorials:

Reference:

  • Oracle Apex Documentation: apex.util.showSpinner()
Vinish Kapoor
Vinish Kapoor

Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 20 years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.

4 Comments

    • You are an experienced developer as I can see from your posts, so can I ask you for an advice.

      I have an application process which downloads a PDF from an external source. The process works but the user experience is quite bad, because the user doesn't get any feedback if the process started.

      I know how to show the spinner but then I don't know when to dismiss it, since as far as I know it can't be stopped by the server side (process).

      Any idea?

Comments are closed.