Home ยป OrclApex ยป apex.util.showSpinner() Example

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" ) );
} );

    function() {
    }, 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: