I'm working on sapui5 application. I want to block UI form users during ajax requests. I added the following code:
var dialog = new sap.m.BusyDialog({
text : this.languageModel.getModelProperty("BUSY_DIALOG_FETCHING_DATA"),
title : this.languageModel.getModelProperty("BUSY_DIALOG_WAIT")
});
var that = this;
jQuery.ajaxSetup({
beforeSend : function() {
console.log("open");
dialog = (dialog) ? dialog : new sap.m.BusyDialog({
text : that.languageModel.getModelProperty("BUSY_DIALOG_FETCHING_DATA"),
title : that.languageModel.getModelProperty("BUSY_DIALOG_WAIT")
});
dialog.open();
},
complete : function() {
console.log("close");
dialog.close();
}
});
In console I get good results, and while debugging I can see dialogs, but in normal mode (without any breakpoints) dialogs don't appear at all. Any clue?
Why not use the busy indicator?
var oController = this;
oController.getView().setBusy(true);
$.ajax({
//your ajax call here,
success: function(data) {
//do whatever needs to be done after success;
oController.getView().setBusy(false);
},
error: function(...) {
oController.getView().setBusy(false);
}
});