function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jingli Hu 3Jingli Hu 3 

add spinning image when VF page using action loading

Hi, 
we have a VF page, which using action in the page tab, since the action is very slow. we would like to put spinnning image. we tried the ationstatus solution. it works for click a button. but in our case, we don't have any button in the page at all. the spinning image is not showing.

Any ideas?
Alain CabonAlain Cabon
Hi,

It is quite difficult to have a stable situation for a spinning image for a VF page using an action at the loading (but it is standard and stable now in Lightning).

The trick is to put the complete VFP as the result of the action status (facet stop) and activate the action status with a javascript function at the end of the page.

You can try this code: https://eltoro.secure.force.com/ShowAnImageWhileThePageIsLoading

Notice that there is no action in the <apex:page> so it is not exactly the same case and the stability is not sure whith this added action but you can try this trick.

When a page is loaded, the javascript function call at the end of the page is executed (here the call to the funciton sayHello). This javascript function call is associated with an action Function of your Visualforce named also sayHello which is real caller of the action status itself myStatus.

<apex:actionStatus id="mystatus" startText="Loading.....">
     <apex:facet name="stop">  // return of the loading
          <apex:outputPanel id="out">
           ...
           // result when the loading is complete (return of {!load} here) : your complete VF page.
          ...
         </apex:outputPanel>
     </apex:facet>
 </apex:actionStatus>

Facets: stop  The components that display when an AJAX request completes. Use this facet as an alternative to the stopText attribute. Note that the order in which a stop facet appears in the body of an actionStatus component does not matter, because any facet with the attribute name="stop" controls the appearance of the actionStatus component when the request completes.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_actionStatus.htm

Alain
TruptiTrupti
Hi @Alain,

Could you please post code over here. The link you shared is asking credentials.