Question

When testing the SplitApp demo app provided with the 1.18.5 SAPUI5 SDK there seems to be a conflict between the routing and model binding. If you navigate to a detail page and then refresh the browser window the data binding fails. This would be the same as if you bookmarked the app on a specific view.

Just wondering if anyone knows why this is? Is it a conflict with routing and data binding? My debugging is not showing anything up yet only that the model is empty when the detail view loads.

This app uses the new Component-based router where you define your routes in the component metadata.

I've also written a small test app here js1972/test · GitHub (branch "routes") which does similar and has the same issue.

Was it helpful?

Solution

the following bookmark works with the fake service ../test-routes/#/detail/Categories(2)

../test-routes/#/detail/Categories(3) doesnt

request.onSend in ODataModelFakeService.js doesnt cater for all scenarios

an alternative maybe to use sap.ui.core.util.MockServer with a cutdown metadata.xml and json files for the Category and Product entities

OTHER TIPS

I've ran into the same issue and just want to share my findings and solution:

The detail view waits until the list in the master view is loaded. If the service you are using is quite slow the list has already finsihed loading, but the model has not finished loading and thus the detail view returns an error. To fix this I've attached an "requestCompleted"-event to the model and created a jQuery.Deferred object for the model. The master then waits for the resolve of the model.

oModel.attachEvent("requestCompleted", 
 			function() {
 						this.oModelFinishedDeferred.resolve();
 						this.getEventBus().publish("Model",
 						"ModelFinished");}
			, this);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top