cancel
Showing results for 
Search instead for 
Did you mean: 

Router Navigation not working consistently

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Chantele
Active Participant
0 Kudos

Have you considered using a fragment and dialog to hold your create content?

Rather than having a new detail view.  This way the fragment will appear in front of the current content, without having to navigate away from the current detail view.

Former Member
0 Kudos

Hi Chantele,

using a Dialog which pops-up for create is surely better way of doing it, it serves the purpose. Will try it. However, I would be interested to understand the behavior of routing in this case.

Thanks, Deni

Chantele
Active Participant
0 Kudos

No problem,

I'm not sure of you will have followed this, but the link below gives you details of routing and navigation within apps

OpenUI5 SDK - Demo Kit