Skip to Content
0

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

Jun 02, 2017 at 09:44 AM

302

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
VAIBHAV GB Jun 02, 2017 at 10:40 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded