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:

Leave a Reply

This Post Has 4 Comments

  1. David

    What if the time varies?

    1. Vinish Kapoor

      Yes, you are right, that is the issue.

      If you are looking to show progress on page submit, then you can check the following post: Submitting page with progress spinner.

      Maybe it will be helpful for you.

    2. David

      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?

    3. David

      Done.

      With the apex.server namespace.