Skip to Content
0
Former Member
May 18, 2016 at 04:51 PM

Router Navigation not working consistently

91 Views

Dear Experts,

I have a custom Master-Detail App created in Eclipse and deployed in SAP Back-end system.

In this App, i have used a SplitApp, and placed a Master View and a Detail View..So far things are perfect...

Now i have added a button in the footer of Master view, which basically should navigate me to a new view and place it in the detail section of SplitApp..

Below is the screen of Master View Footer with button..

When i run the App, initially i see the below...

In this state , if i click on ➕ button in Footer of Master View, it navigates to the new view(create) i have created and places it in the detail section of SplitApp..again so far it is all fine.

Now, if i click/select any of the listed items in the master section of App, it navigates to the Display view...this also fine, right after this, if i click on ➕ button in Footer of Master View, it navigates to the new view(create) and it returns back immediately to the Display view. Ideally it should stay in the create view...


So in nutshell, if we play around with listed items in master view and then try to navigate to create view by clicking on ➕ button in Footer of Master View, it goes to the create view and then immediately comes back. If we directly try to navigate to create view with out clicking any of the listed items in the master view, then the navigation is as expected.

I have used Component.JS...below is the code in it...

metadata: { routing: { config:{ viewType: "JS", viewPath: "lclfdr.views", targetControl: "myApp", clearTarget: false }, routes:[{ pattern: "", name: "master", view: "Master", targetAggregation: "masterPages" }, { pattern: "simple", name: "empty", view: "SimpDisp", targetAggregation: "detailPages" }, { pattern: "FbookSet/{uniqueId}", name: "detail", view: "Detail", targetAggregation: "detailPages" }, { pattern: "create", name: "create", view: "Create", targetAggregation: "detailPages" } ] } }



Code used to navigate to create view in controller...


var oRouter = sap.ui.core.UIComponent.getRouterFor(this);

oRouter.navTo("create");



code used to navigate to display view in controller...


var oRouter = sap.ui.core.UIComponent.getRouterFor(this); oRouter.navTo("detail",{uniqueId: itemData.Bookid});



I'm not able to find the issue why the navigation is not consistent...Any help would be very much appreciated.

Eagerly look forward to the inputs which will help me in solving the issue and also for the learning.


Thanks, Deni

Attachments

Master.JPG (13.5 kB)
Initial.JPG (40.1 kB)