Dear GreatMinds,
I struck up with opening busydailog when calling the create request(synchronous) .I tried
oModel.attachRequestSent(function(){
myBusyDialog.open();
});
oModel.attachRequestCompleted(function(){
myBusyDialog.close();
});
and
myBusyDialog.open();
oModel.create('/entity', ovalue, null,
function(res) {myBusyDialog.close();},
function(res){myBusyDialog.close();})
But both are not working in my case.
Please do the needful.
Thanks In Advance.
Hi,
I think I know what the issue is here. You might be getting multiple "requestCompleted" events fired. So, request 1 (opens the dialog), request 2, response 1 (closes dialog), response 2 (the one you are interested in). This could be caused by the CSRF token for example.
What I usually do with the the busy loader is count how many requests go out and only close the busy dialog when we have all responses in, something like the following (untested and coded here so be warned!):
var myCounter = 0; model.attachRequestSent(function() { myBusyDialog.open(); myCounter += 1; )); model.attachRequestCompleted(function() { if (myCounter>1) { myCounter -= 1; } if (myCounter == 0) { myBusyDialog.close(); } ));
Remember also to attach something to the requestFailed event (perhaps a nice sap.m.Dialog to display the error) and also to fire the same function for request completed. This usually ends up in its own utility object in my projects, constructed by passing in a model object so that we only have one busy dialog & one counter mechanism even if we have multiple models.
Hope this helps,
Oli
Can you share how you have instantiated your BusyDialog?
Do you see any errors in the console?
Try commenting the myBusyDialog.close();
So that application will display busy dialog all the time and if you find any errors in console, do share.
request could have completed quickly. So only you were not able to see the dialog.
Use timer event function and try put the dialog close inside the function. You will be able to see the dialog.
Add a comment