I try to create a SAPUI5/OpenUI5 application. For that I use some XML-views and navigate between this with a router. Now, I want to call a method every time a specific view is opened. After reading that the method onBeforeRendering
solves this case, I implement this function. When I navigate first time to the view the method was used, but not in the second call.
Here the code of the View-Controller:
sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/ui/model/json/JSONModel"],
function(Controller , JSONModel) {"use strict";
return Controller.extend("Spellcheck.controller.Result", {
onBeforeRendering: function() {
this.model = new sap.ui.model.json.JSONModel({
suggestionData: []
});
this.getView().setModel(this.model);
this.model.refresh();
this.getCorrections();
},
getCorrections : function() {
//...some other code...
}
I hope someone know the reason and/or suitable solution for my problem