Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3193

Async ODataModel.read() seems not to work

$
0
0

Hi,

 

I have a test application with following method executed on button press:

 

_loadData: function(){  // FIRST ODATA CALL  this.getView().byId("idPanelOne").setBusy(true);  this.getOwnerComponent().getModel("oDataService").read("/DashboardDataSet", {  "async": true,  "urlParameters": {"$expand": "DashboardTimeboxSet"},  "filters": [  new sap.ui.model.Filter({  path: "SprintStatus",  operator: sap.ui.model.FilterOperator.EQ,  value1: "01"  })  ],  "success": function(oData) {  this.getView().getModel("oModelOne").setData(oData.results[0].DashboardTimeboxSet);  this.getView().byId("idPanelOne").setBusy(false);  }.bind(this),  "error": function(oError) {  var oErrorBody = JSON.parse(oError.responseText);  alert(oErrorBody.error.message.value);  }  });
// SECOND ODATA CALL  // This call should take 2 seconds longer (WAIT UP TO 2 SECONDS in oData)  this.getView().byId("idPanelTwo").setBusy(true);  this.getOwnerComponent().getModel("oDataService").read("/DashboardDataSet", {  "async": true,  "urlParameters": {"$expand": "DashboardStorySet"},  "filters": [  new sap.ui.model.Filter({  path: "SprintStatus",  operator: sap.ui.model.FilterOperator.EQ,  value1: "01"  })  ],  "success": function(oData) {  this.getView().getModel("oModelTwo").setData(oData.results[0].DashboardStorySet);  this.getView().byId("idPanelTwo").setBusy(false);  }.bind(this),  "error": function(oError) {  var oErrorBody = JSON.parse(oError.responseText);  alert(oErrorBody.error.message.value);  }  });
// THIRD ODATA CALL  this.getView().byId("idPanelThree").setBusy(true);  this.getOwnerComponent().getModel("oDataService").read("/DashboardDataSet", {  "async": true,  "urlParameters": {"$expand": "DashboardActivitySet"},  "filters": [  new sap.ui.model.Filter({  path: "SprintStatus",  operator: sap.ui.model.FilterOperator.EQ,  value1: "01"  })  ],  "success": function(oData) {  this.getView().getModel("oModelThree").setData(oData.results[0].DashboardActivitySet);  this.getView().byId("idPanelThree").setBusy(false);  }.bind(this),  "error": function(oError) {  var oErrorBody = JSON.parse(oError.responseText);  alert(oErrorBody.error.message.value);  }  });
}

The 3 read() methods are calling an odata service in sap system.

The odata method of the second call has a WAIT UUP TO 2 SECONDS in its code.

So i would expect that may PanelTwo is in busy state 2 seconds longer than One and Three.

 

But it isn't.

 

One and Three need the same time as Two.

If I remove the second call One and Three are both loaded nearly instant.

 

It seems that UI5 is waiting for all 3 calls to be finished before their success functions are called.

 

Any Idea how the success functions can get called independently?

 

Thanks & Regards,

Dominik


Viewing all articles
Browse latest Browse all 3193

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>