cancel
Showing results for 
Search instead for 
Did you mean: 

How to navigate back to master view from detail view while loading the app initially?

former_member195820
Participant
0 Kudos

Hi all,

I use XML view for coding. When I login to the app, it directly goes to the detail page in the mobile view and I'm unable to go back to my Master page. I need to show the master list initially or my detail page should automatically show a back button to navigate to master page.

Here I have attached my component.js code:

routing: {
config: {
viewType: "XML",
viewPath: "ExitProcess.views",
clearTarget: false,
controlId: "idSplitApp",
controlAggregation: "pages",
transition: "show"
       },
routes: [
  { 
 pattern: "",
 name: "Master",
 target: "Master",
 controlAggregation: "masterPages"
 },
 {
 pattern:"Detail/{EmployeeId},{WorkitemId}",
 name :"Detail",
 target: "Detail",
 controlAggregation: "detailPages"
},
					 
],
targets: {
Master: {
viewName: "Master",
controlAggregation: "masterPages"
},
Detail: {
viewName: "Detail",
controlAggregation: "detailPages"
},
}
} 

I didn't get the menu button that navigates to the master page in mobile view. Can someone help me with this?

Regards,

Ramya.

Accepted Solutions (1)

Accepted Solutions (1)

vaibhav_gb
Explorer
0 Kudos

Hi Ramya,

you can follow anyone of the following solutions which suits best for your case:

Solution 1: If the detail is loading after the master list is loaded i.e in the updateFinished method of the master list then you can add a small check in this method to restrict the load or routing to detail page. like follows

if(sap.ui.Device.system.phone){
return;
}

Solution 2: to enable the nav back button in the detail view add this piece of code and in the controler for the navback event route back to master page. this is when the device model is set.

 showNavButton="{device>/system/phone}"

solution 3: manually setting a json model, assign the json to detail screen and refer the path in showNavButton property in detail screen an example code like follows

//in onInit of Controller<br>	var d = false;
			if (sap.ui.Device.system.phone) {
				d = true;
			}
<br>	var oViewModel = new JSONModel({
				device: d
			});
this.getView().setModel(oViewModel, "detailView");

//in Detail.view 

	<Page showNavButton="{detailView>/device}" navButtonPress="onNavBackDetail"/>

regards

GB

Answers (0)