cancel
Showing results for 
Search instead for 
Did you mean: 

how do i route between master-detail pages?

former_member592880
Participant
0 Kudos

hello,

i am working on a master detail template using split app as a base.

i am using the toDetail method of o to navigate to detail page but i keep getting error saying Cannot read property 'toDetail' of undefined

App

<mvc:View controllerName="com.sap.build.standard.specialPriceApproval.controller.App" xmlns:mvc="sap.ui.core.mvc" displayBlock="true"
	busy="{appView>/busy}" busyIndicatorDelay="{appView>/delay}" xmlns="sap.m">
	<SplitApp id="idAppControl"/>
</mvc:View>

Master

	onPress: function (oEvent) {
			var that = this;
			var obj = {};
			var sToPageId = oEvent.getParameter("listItem").getProperty("title");
			obj.reqNo = sToPageId;
			that.byId("idAppControl").toDetail("detail1", "flip", obj);
		}

Detail

	oView.addEventDelegate({
				onBeforeShow: function (oEvent) {
					console.log(oEvent);
					if (sap.ui.Device.system.phone) {
						var oPage = oView.getContent()[0];
						if (oPage.getShowNavButton && !oPage.getShowNavButton()) {
							oPage.setShowNavButton(true);
							oPage.attachNavButtonPress(function () {
								this.oRouter.navTo("", {}, true);
							}.bind(this));
						}
					}
				}.bind(this)

how do i resolve this??

thanks and regards

Siddharth

maheshpalavalli
Active Contributor
0 Kudos

Simple way is to just generate the app using the template provided by sap. It has all the main code, then understand it and implement for other views.

former_member592880
Participant
0 Kudos

maheshkumar.palavalli I used a template from Build.me but still the navigation needs to be configed into it. the pattern needs to be set in the manifest to suite the requirements of the application. that part was where I was getting stuck.

Accepted Solutions (1)

Accepted Solutions (1)

former_member592880
Participant
0 Kudos

so the issue got resolved.

the application needs a pattern that is configed in the manifest wherein you set the url pattern that you'll be using when calling the page and using that pattern the routing needs to be done and values need to be passed.

this blog here has the details related to the same :

https://help.sap.com/doc/saphelp_uiaddon20/2.05/en-US/23/66345a94f64ec1a80f9d9ce50a59ef/content.htm?...

thanks to everyone for your help 🙂

regards

Siddharth

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos
that.byId("idAppControl")

app is not part of your main view, that's why it failed

please use routing, not the ui element capability to do the navigation

former_member592880
Participant
0 Kudos

hello,

yes app is not part of the main, then can you please suggest other option I can use for this navigation plus the data transfer with it

thanking and regards

Siddharth

junwu
Active Contributor