cancel
Showing results for 
Search instead for 
Did you mean: 

BusyIndicator is not loading in simple odata calls

muhsin_panakkal
Participant
0 Kudos

Hai Experts,

I am developing one SAPUI5 application, in that I am trying to use busy indicator while triggering the odata and need to close it once after getting the response. I am using the below code.

this.getView().setBusy(true);

this.getView().setBusy(false);

but the above is not working as expected, Tried using the setTimeout() , but no luck. Kindly help me to resolve the same.

Thanks,

Muhsin

Accepted Solutions (0)

Answers (2)

Answers (2)

mvaibhav
Contributor

Hi Muhsin,

Please try with the following code :

	var oDataModel = this.getView().getModel(); // Model used for triggering the Odata Request
	oDataModel.attachRequestSent(function() {
					sap.ui.core.BusyIndicator.show(100);
				});
	oDataModel.attachRequestCompleted(function() {
					sap.ui.core.BusyIndicator.hide();
				});

Thanks,

Vaibhav Maheshwari

muhsin_panakkal
Participant
0 Kudos

Dear Vaibhav,

Thanks for your reply..

Its working now, I have used the below code to close the busy indicator.

jQuery.sap.delayedCall(500, this, function(oEvent) {
this.getView().setBusy(false);
});

Thanks,

Muhsin

imsuryapandiyan
Participant
0 Kudos

Dear Muhsin,

The above method you are using is not recommended. Your oData call may take more than 500ms sometimes.

Better to use success and error method of oData call.

this.oModel().read(sPath, {
			success: function(oData) {
					this.getView().setBusy(false);
				}.bind(this),
			error: function(error) {
					this.getView().setBusy(false);
				}.bind(this)
			});