SAPUI5 why is the global BusyIndicator hiding too early?

653 views Asked by At

I've shown my BusyIndicator in the routeMatched() function

sap.ui.core.BusyIndicator.show();

Later on, this is hidden after I set the page to visible again.

...
...
... 

    self.getView().byId("Page1").setVisible(true);
    sap.ui.core.BusyIndicator.hide();

The issue is: Because the view is shown again soon after, the indicator is hidden again, however, on a slower mobile, the page is in the process of rendering AFTER hiding the Indicator.

I need the view completely hidden until it's finished loading..

Any ideas?

2

There are 2 answers

0
Francesco Iannazzo On

If your application is loading data before rendering, hide the busyIndicator in the success method of your AJAX requests.

If you are using oData Model, attach a listener to the batchRequestCompleted event of the oData Model and hide the BusyIndicator when the event is fired.

This should optimize the behavior on a mobile device. Because of the asynchronous behavior of the SAPUI5 framework of rendering elements depending on the received data, it can be that some UI elements are still rendering, although the page is already visible.

0
Adam Harkus On

The solution was to use sap.m.busyIndicator as opposed to sap.ui.core.BusyIndicator.