cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Back Navigation to previous view - view not updated

3,808

Hi,

I have following problem: I have an application with two views and want to navigate between them. Navigation from default view to my details view works fine, but if I want to navigate back the screen does not refresh. In the url I see that the history is correct, the url changes by navigation back to the previous url, but the view do not change. Do anybody know how I cant solve this? Do I have to refresh the view manually? In all examples back navigation works automatically...

Kind regards

Katrin

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

in the dev console->sources tab you can view the structure of your view and controllers, once you open the route the resource is loaded once, navigate to another route the resourc for the route is loaded too, but when you press back nothing is loaded so thats fine.

in your component.js did you initialize router?

0 Kudos

init is only called once, if the route view controller is already created will not go through it again,unless you create a function on current route with attachMatched then the function will be called evertime the route is accessed.

in the dev console,source, correct controller and view is loaded? maybe you can share snippet your xml and controller?

0 Kudos

Ahh ok, than it's fine that init is not called, but nevertheless I have a problem with updating my view.

If I call the app first time the view and controller of my app-starting-view is called (view of url in array 1).

If I navigate to the second view in my app, the view and controller are called too:

But if I navigate back controller and view of first view is not loaded again. Is that the problem?

0 Kudos

browser back button or js window.history.go(-1) works fine, check dev console?

0 Kudos

Hi, I checked windowd.history. It looks good. I am on history array 2 and want to go back to 1. windowd.history.go(-1) dosen't create an error in dev console, the url navigation change to the one in array 1 (everthing fine), only the view is not changing (init method of the view is not called too)....

former_member709916
Participant
0 Kudos

Hi Katrin. Answering to your question, yes, initializing the router will evaluate the current URL and load the corresponding view automatically. Try and check the manifest.json routing section: routes and targets names. The method below should work, but if not, may be you can share more details here if possible.

onPress:function(oEvent){

var oRouter = sap.ui.core.UIComponent.getRouterFor(this);

oRouter.navTo("detail");}

0 Kudos

Hi, route and target names seem to be right. NavTo Detail works fine, even back navigation does not work...