“onBeforeRendering” or “onAfterRendering” is not called every time the view is opened

前端 未结 4 790
庸人自扰
庸人自扰 2020-12-11 07:16

In my UI5 app, I have a view with a table (sap.m.Table), populated by data coming from the back-end at onInit hook. The problem is that onInit is e

4条回答
  •  死守一世寂寞
    2020-12-11 08:11

    You should use

    onInit: function() {
        let route = this.getOwnerComponent().getRouter().getRoute("yourroutename");
        route.attachPatternMatched(this.onRoutePatternMatched, this);
        // ...
    },
    

    This route event will be triggered every time the route pattern is matched in your routing config. In the above example, the function onRoutePatternMatched will be called every time the route is loaded through navigation.

    onRoutePatternMatched: function(event) {
        // this logic will repeat itself every time the route pattern is matched
    },
    

提交回复
热议问题