cancel
Showing results for 
Search instead for 
Did you mean: 

Wait Until OData Request Completed

former_member1413
Participant
0 Kudos

Hello Team,

I have a requirement to oData service inside onExit hook method. I have written below code but unfortunately oData service is not getting called as view is destroyed immediately . Is there any way to add wait or delay the destroy of view until oData read request is complete ?

 window.addEventListener('beforeunload', (event) => {this._mainService.read("/GreVersLockSet(Gremienversionid=guid" + "'" + this._PreviousGreVersion + "'" + ",LockFlg=" + false + ")",
 null, null, false,
 {
 success: function (data) {
 that._PreviousGreVersion = "";
 }
 });
}
View Entire Topic
vinibar
Participant
0 Kudos

The sap.ui.core.mvc.View class has an event called beforeExit. You can try to put the OData request into it.

former_member1413
Participant
0 Kudos

I tried but oData service is not getting called