on 01-21-2015 9:45 AM
Hi Guys,
I implemented an ODate request and attached a RequestSent and a RequestCompleted eventhandler. The first calls a function to show a BusyDialog and the second one calls a function to close the BusyDialog.
The request has the following timing:
The waiting time can be something between 7s and 15s (I know that this is quite some time^^).
My Problem is, that the SDK states the following:
The 'requestCompleted' event is fired, after a request has been completed (includes receiving a response), no matter whether the request succeeded or not.
In my opinion this means, that my RequestCompleted event would be called after the waiting and download time. Strangely though, it gets called right away and I do not see any BusyDialog.
This is some of my code:
var model = sap.ui.getCore().getModel();
model.attachRequestSent(view.getController().handleRequestSent());
model.attachRequestCompleted(view.getController().handleRequestCompleted())
handleRequestSent : function () {
bs = new sap.m.BusyDialog("busybusy");
bs.placeAt("content");
bs.open();
},
handleRequestCompleted : function () {
bs = sap.ui.getCore().byId("busybusy");
bs.close();
bs.destroy();
}
Can anybody explain this behaviour to me ?
Thanks
Hello Maksim and Sergio,
thank you for your answers. I already tried different approaches to show a busy state but none of them worked because of my main problem:
The function handleRequestCompleted() gets called right away but I expect it to be called after the waiting time and the content download time because in my mind this is the point where the request is completed.
Somehow though the SAPUI5 framework thinks the request is completed after "request sent" and thus I do not see any BusyIndicator but I am still waiting some seconds to get some data.
I hope you can understand my problem. There is nothing wrong with my BusyIndicator or BusyDialog but with the time at which the requestCompleted event is triggered.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
that.fireRequestCompleted({url : oRequest.requestUri, type : "GET", async : oRequest.async, info: "Accept headers:" + that.oHeaders["Accept"], infoObject : {acceptHeaders: that.oHeaders["Accept"]}, success: true});
ODataModel will take care of it, it is a call back handler. Do you see parameter coming to handleRequestCompleted ?
Couple points
1) sap.ui.model.Model has attachRequestFailed event
2) As mentioned by Sergio, don't create new dialog every time request is sent, have is as a variable of controller
var model = sap.ui.getCore().getModel();
model.attachRequestSent(view.getController().handleRequestSent());
model.attachRequestCompleted(view.getController().handleRequestCompleted())
..........
//Controller
..........
bs : new sap.m.BusyDialog("busybusy"),
handleRequestSent : function () {
this.bs.open();
},
handleRequestCompleted : function () {
this.bs.close();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nils,
it looks like you create the new busyDialog object everytime you come into the event handler. so the object busybusy may get duplicate id error or possible a different id assigned by the framework to avoid collisions..
I am not sure if you have to do a place At.. then open... you could try simply opening it.. or another suggestion would be to try:
sap.ui.core.BusyIndicator.show()
sap.ui.core.BusyIndicator.hide()
hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.