on 01-09-2015 10:49 PM
Hello,
I’m trying to display a BusyIndicator on my screen after a button click event, and hide it when execution of the corresponding call returns. If I put a breakpoint in my code before the AJAX call fires, the busy indicator appears, but if I do not have a breakpoint and click the button, the busy screen never pops up, even though execution of the call takes 20-25 seconds. What can I change to make sure the busy indicator comes up every time?
executeCall = function (oData, viewPrefix) {
var message = [];
var success = false;
sap.ui.core.BusyIndicator.show(0);
$.ajax({
type: 'POST',
url: pps.config.pmvSvcUri,
data: JSON.stringify(oData),
contentType: 'application/json',
async: false
}).done(function (results) {
if (results.errors.length > 0) {
utilities.displayError(results.errors[0]);
}
else if (results.messages.length > 0) {
results.messages.forEach(function (msg) {
message.push(
+ "EVENT_DATE: " + msg.EVENT_DATE + "; \n"
+ "USERID: " + msg.USERID + "; \n"
+ "FUNCTION_NAME: " + msg.FUNCTION_NAME + ";\n"
+ "ERROR_MSG: " + msg.ERROR_MSG + "; \n"
+ "ERROR_CODE: " + msg.ERROR_CODE + "; \n"
+ " - " + msg.ERROR_DTL
+ "\n");
});
utilities.displayError(message[0], results.messages[0].ERROR_MSG);
sap.ui.core.BusyIndicator.hide();
}
else {
success = true;
if (results.insertedPmtId){
oData[0].ID = results.insertedPmtId;
}
sap.ui.core.BusyIndicator.hide();
}
}).fail(function (results) {
if (results.error.length > 0) {
utilities.displayError("Error: " + results.error, 'Error');
}
else {
utilities.displayError("Error: " + results.status + ' ' + results.statusText, 'Error');
}
sap.ui.core.BusyIndicator.hide();
});
return success;
},
hi Andy
If the ajax call is synchronous, then the browser to block until the response returns, hence there are no chance for the indicator to appear.
thanks
-D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.