"Loading" spinner

Jon Tibbetts asked on November 26, 2014 17:51

Is there a way for me to call the loading spinner from the api when I have a background task that takes a long time.

Correct Answer

Vilém Jeniš answered on November 28, 2014 09:02

Hi Jon!

You can use our API to register the javascript module 'Loader' on your page. For that you'd use

ScriptHelper.RegisterLoader(Page);

You'll then need to make the loader appear. If properly registered the loader should be available in the Javascript variable

window.Loader

and supports calls like

window.Loader.show();
window.Loader.hide();

However I'd like to suggest using this C# method as well:

ScriptHelper.RegisterPageLoadedEvent(Page);

Internally this method registers a Javascript which is rendered at the end of the request. The Javascript code enables the 'pageLoaded' flag and fires PageLoaded Event on the EventHub. This hides the Loader.

Your approach depends on how you're handling all the other things your application does during the long running task.

One last note: I have to tell you, that JavaScript API is not what we consider our public API and it may change without notice. During upgrade or hotfix. However unlikely it is to change 'show' and 'hide' commands of a Loading indicator, I had to tell you.

5 votesVote for this answer Unmark Correct answer

Recent Answers


Jon Tibbetts answered on December 1, 2014 15:55

yup that worked, thanks

0 votesVote for this answer Mark as a Correct answer

Prateek Gupta answered on August 2, 2018 09:21

Thank you, this worked.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.