on 07-03-2015 8:42 AM
Hi All,
I has back button in Goods.view.XML and the handler present in Goods.controller.js.
I want to navigate back to Master.view.XML , but i am not able to since my onRouteMatched is getting called for Master controller than Goods controller.
I dont understand why it is calling Goods onRouteMatched
Code
-----------------------------------------
onNavBack : function()
{
// This is only relevant when running on phone devices
var oHistory = sap.ui.core.routing.History.getInstance();
var sPreviousHash = oHistory.getPreviousHash();
//The history contains a previous entry
if (sPreviousHash !== "") {
window.history.go(-1);
} else {
var bReplace = true; // otherwise we go backwards with a forward history
detailView.router.navTo("master",{},bReplace);
}
},
---------------------------------
Master.controller.JS
onInit : function()
{
selfView.router = sap.ui.core.UIComponent.getRouterFor(this); | ||||||
selfView.router.attachRoutePatternMatched(this.onRouteMatched, this); |
}, |
onRouteMatche: function() | ||||||||
{ | ||||||||
debugger; | ||||||||
selfView.getUnitDetails(); | ||||||||
sap.ui.getCore() | ||||||||
.getElementById("Master--idItemDetails") | ||||||||
.setVisible(false); | ||||||||
this.byId("idDocumentDate").setDateValue(new Date()); | ||||||||
this.byId("idPostingDate").setDateValue(new Date()); | ||||||||
this.byId("idDocumentDate").setEnabled(false); | ||||||||
}, |
Goods.controller.js
-----------------------------------
onInit : function ()
{
detailView.router = sap.ui.core.UIComponent.getRouterFor(this);
detailView.router.attachRoutePatternMatched(this.onRouteMatched, this);
}
onRouteMatched : function(oEvent) {
debugger;
console.log("Goods");
var oParameters = oEvent.getParameters();
detailView.getItems(oEvent.getParameters().arguments);
},
Component.js
---------------------------
routing : {
config : {
viewType : "XML",
viewPath : "cgi_GoodsReceipt_GRN.view",
targetControl : 'mainContent',
// targetAggregation : "pages",
clearTarget : false,
transition : 'slide'
},
routes : [ {
pattern : "",
name : "master",
view : "Master",
viewLevel : 0
},
{
pattern : "Goods/{Mblnr}/{Mjahr}",
name : "Goods",
view : "Goods",
viewLevel : 3,
targetAggregation: "pages"
}, ]
},
},
Hi Experts,
Do you have solution to this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.