cancel
Showing results for 
Search instead for 
Did you mean: 

UI5 routing issue/Advice

gary_king2
Participant
0 Kudos

We have a landing page whereby a decision is made as to what journey the client needs to take using the app. Let's assume we have journey 1,2, and 3. We have 3 XML views and controllers for this journey, and only one will ever be called. The landing page controller decides which of the 3 journeys/views it needs to navigate to. At present though only 1 of these views exists (MainView1). So far so good.

Eventually each of the three views will contain a specific IconTabBar for the journey and these tabs will call views (in the XML) using the method

<mvc:XMLViewviewName="tabLayout.view.SomeKindaView"/>

So, at present MainView1 (representing Journey1) has an IconTabBar whereby one of the tabs calls and displays the view "SomeKindaView". This view has a button to display further data in another view, say "SomeKindaView2" and it may navigate to this using self.getOwnerComponent().getRouter().navTo("SomeKindaView2"); in its controller. The view "SomeKindaView2" also has a back button function, something like:

_self.getRouter().navTo("Mainview1", {} , true );

All this works fine via routing, but, the immediate navigation shown on the above line will always nav back to MainView1, however, I need it to navigate back to MainView1, or MainView2 or MainView3 depending on the journey defined in the landing page. This journey will probably be recorded in a JSON object in the controller of the landing page.

How can I decide which MainView to navigate back to?. I guess I could set a JSON object, say "ojourney" to contain either 'MainView1, 2 or 3' depending on the journey, and then perhaps use:

_self.getRouter().navTo("{/ojourney}", {} , true );

Is that likely to work?.

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

not sure if binding will work or not. but the following should work.

var targetView=YOURJSONMODEL.getProperty("/ojourney")

_self.getRouter().navTo(targetView, {} , true );

Answers (0)