on 2020 Nov 24 3:05 PM
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
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
browser back button or js window.history.go(-1) works fine, check dev console?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)....
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");}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.