Skip to Content
author's profile photo Former Member
Former Member

Back Navigation

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"

}, ]

},

},

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 06, 2015 at 06:29 AM

    Hi Experts,

    Do you have solution to this?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 12, 2020 at 03:29 AM

    The Order should the same, then once you use the History system could work.


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.