Hi,
We are having 3 views and the navigation from View0 to View1 is happening in right manner, but navigation from View1 to View2 is happening without triggering onInit function of View2 and we are not getting errors in console as well.
My View 1 Controller code is:
sap.ui.define([
"sap/ui/core/mvc/Controller",
"QuickStartApplication/model/models",
"sap/ui/model/json/JSONModel",
"sap/ui/model/Filter",
"sap/ui/model/FilterOperator"
], function (Controller,models,JSONModel,Filter,FilterOperator) {
"use strict";
var flag = " ";
return Controller.extend("QuickStartApplication.controller.View1", {
onInit: function() {
this._oRouter = this.getOwnerComponent().getRouter();
},
onAfterRendering : function() {
if (flag != 'X') {
var oFilter = new Filter('SBU_DESC',FilterOperator.EQ,"NULL");
this.getView().byId("idTable").getBinding("items").filter([oFilter], "{Default>/workcapital}"); /*""Application");*/
}
},
OnV1press : function(oEvent) {
flag = 'X';
var BG = oEvent.getSource().getSelectedItem().getBindingContext("Default").getObject().BG_DESC;
this._oRouter.navTo("View2",{
BG: BG
});
}
});
});
View 2 Controller Code:
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function (Controller) {
"use strict";
return Controller.extend("QuickStartApplication.controller.View2", {
onInit: function() {
debugger;
this._oRouter = this.getOwnerComponent().getRouter();
this._oRouter.getRoute("View2").attachPatternMatched(this.handler, this);
},
handler: function(oEvent){
var BG = (oEvent.getParameter("arguments").BG);
debugger;
}
}
});
});
In Manifest Json:
"routes": [{
"name": "View0",
"pattern": "View0",
"titleTarget": "",
"target": []
}, {
"name": "View1",
"pattern": "View1",
"titleTarget": "",
"greedy": false,
"target": ["View1"]
}, {
"name": "View2",
"pattern": "View2/{BG}",
"titleTarget": "",
"greedy": false,
"target": ["View2"]
}]
Need your inputs plz.