How to Show/Hide Busy Indicator SAPUI5

Hari picture Hari · Jun 23, 2016 · Viewed 20.4k times · Source

I need to show busy indicator during AJAX call. So I have used <BusyIndicator text="Please wait ..."/>. How to Show/Hide this indicator in controller?. Now its always showing.

Answer

nistv4n picture nistv4n · Jun 23, 2016

There are two BusyIndicators in UI5. sap.m.BusyIndicator is used to create a customized busy indicator. In this case, you should destroy the object reference after it's not necessary anymore (of course, you have to maintain a reference object for the BusyIndicator). This type should be used if you want to indicate that only a specific part of the UI is loading. (For these situations, you can use the control's setBusy() function)

For a global busy indicator, sap.ui.core.BusyIndicator can be used. It cannot be customized; it's just a loading icon. You can display it using the sap.ui.core.BusyIndicator.show(); and hide it using the sap.ui.core.BusyIndicator.hide(); function.

If you are using Pages in your application, you can set the busy status of the page itself; you can bind this property to a Model and you can control the indicator by setting the model property.

You can find more details here.