我尝试创建一个SAPUI5/OPENUI5应用程序.为此,我使用了一些XML视图,并在路由器之间进行导航.现在我想在每次打开特定视图时调用方法.在阅读了"onBeforeRendering"方法解决了这种情况之后,我实现了这个功能.当我第一次导航到视图时,使用了该方法,但在第二次调用中没有.
这里是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...
}
Run Code Online (Sandbox Code Playgroud)
我希望有人知道我的问题的原因和/或合适的解决方案
提前致谢!!!
蒂姆
sapui5 ×1