MsIcklerly
MsIcklerly

Reputation: 69

SAPUI5 - Update View

So I am navigating from one page to another called "chart" with the following line:

this.getRouter().navTo("chart");

The first time I visit the page the content is updated. Do I go there the second time via the code the onInit() and the other standard functions are not called. I tested it with an alert() in each. How can I create a function that updates my view every time the page is visited?

Upvotes: 1

Views: 157

Answers (2)

Bernard
Bernard

Reputation: 1238

onRouteMatched : function(oEvent) {

triggers when your route is matched

Upvotes: 1

keshet
keshet

Reputation: 1826

As an option, you can destroy() your view each time you navigate off it. And create it when navigating to it. This way your onInit() and other functions which are called on start up, will be called and executed.

Your onInit() and other standard functions are not called when you navigate to the view for the second time because the view is already rendered.

Upvotes: 0

Related Questions