cancel
Showing results for 
Search instead for 
Did you mean: 

Where to define entry point for routing inside a SplitApp?

defue
Explorer
0 Kudos

Hi,

I am looking for a way to choose which route my component.js takes first.

My app contains 3 Master/Detail-Views inside 1 SplitApp.

So I have 3 routes: MasterA -> DetailA, MasterB ->DetailB and MasterC->DetailC

How or where can I tell my app which route it takes first? Right now it takes the route, which is first declared in my manifest.json.

Accepted Solutions (0)

Answers (4)

Answers (4)

junwu
Active Contributor
0 Kudos
"pattern": "", should be unique, I am not using subroute. 

maheshpalavalli
Active Contributor
0 Kudos

Actually it depends on the pattern..

Usually when u run a fiori app, it goes and checks in the routes that u defined and will pick the route which has the pattern as empty. Because fiori app runs first time with empty pattern. so where ever u give the pattern as ' pattern:"" ' that particular rout will be pickd

defue
Explorer
0 Kudos

Ok I understand. So if I give each of my routes a different pattern I can decide which is my starting route? If so, where can I do it?

maheshpalavalli
Active Contributor
0 Kudos

Like i mentioned, whichever the route is having the pattern empty will be triggered first. Yeah, so it is up to you to define which route to be called based on the empty pattern.

defue
Explorer
0 Kudos

The thing is, that I want to call the first route dynamically. Depending on a parameter which starts the app.

More accurate: I want to do 3 tiles for my app. Each tile gives another parameter (App, User, Scenario) to my app. Inside my app I will then decide which route it shall take.

My assumption is, that I have to read the input parameter in my component.js. And then I have to "call the route".

maheshpalavalli
Active Contributor
0 Kudos

Super.

Actually I am not sure how to default a particular route(even if it is possible or not). But you can do one thing, call navTo method in component by passing your respective route name and parameters.

e.g.,

var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
			oRouter.navTo("detail", {
				invoicePath: oItem.getBindingContext("invoice").getPath().substr(1)
			});
junwu
Active Contributor
0 Kudos

yes, you define your route based on the url pattern.

defue
Explorer
0 Kudos

Can you give me an example?

My routes are right now like this:

"routes": [ {
				"pattern": "",
				"name": "MasterUsers",
				"target": [
					"MasterUsers"
				],
				"subroutes": [{
					"pattern": "DetailUsers/{Username}",
					"name": "DetailUsers",
					"target": [
						"DetailUsers"
					]
				}]
			},{
				"pattern": "",
				"name": "MasterApplications",
				"target": [
					"MasterApplications"
				],
				"subroutes": [{
					"pattern": "DetailApplications/{Application}",
					"name": "DetailApplications",
					"target": [
						"DetailApplications"
					]
				}]
			}, {
				"pattern": "",
				"name": "MasterScenarios",
				"target": [
					"MasterScenarios"
				],
				"subroutes": [{
					"pattern": "DetailScenarios/{Scenario}",
					"name": "DetailScenarios",
					"target": [
						"DetailScenarios"
					]
				}]
			}]

And my app always starts with "MasterUsers".

junwu
Active Contributor
0 Kudos

in the route you defined.

defue
Explorer
0 Kudos

In my manifest.json?