cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 3 page navigation issue

0 Kudos

Hello Experts,

I am developing a 3 page sapui5 app with router for navigation. 1st and 2nd pages navigate correctly. 2nd page is loading always when going from 2nd page to 3rd page. Below is manifest.json config for routing and targets.I found that view of 3rd page is not at all loading. I put an alert in 3rd view and it does not show.

Any clues whats going wrong here?

Thanks

Pradeep

"routes": [{
				"name": "overViewRoute",
				"pattern": "",
				"titleTarget": "",
				"greedy": false,
				"target": ["overViewTarget"]
			}, {
				"name": "detailViewRoute",
				"pattern": "{selectedOrgUnit}",
				"titleTarget": "",
				"greedy": false,
				"target": ["detailViewTarget"]
			}, {
				"name": "empDetViewRoute",
				"pattern": "{PERNR}",
				"titleTarget": "",
				"greedy": false,
				"target": ["empDetViewTarget"]
			}],
			"targets": {
				"overViewTarget": {
					"viewType": "XML",
					"transition": "slide",
					"clearAggregation": "true",
					"viewName": "overView",
					"viewLevel": 1
				},
				"detailViewTarget": {
					"viewType": "XML",
					"transition": "slide",
					"clearAggregation": true,
					"viewName": "detailsView",
					"viewLevel": 2
				},
				"empDetViewTarget": {
					"viewType": "XML",
					"transition": "slide",
					"clearAggregation": true,
					"viewName": "empDetView",
					"viewLevel": 3
				}
Below is  2nd page controller.js code to navigate to 3rd page:

showEmpDetails : function(oEvt){
			var oModel = this.getView().getModel();
			var oPath = oEvt.getSource().getParent().getBindingContextPath();
			var oData = oModel.getProperty(oPath);
			var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
			oRouter.navTo("empDetViewRoute",{ PERNR : oData.pernr });
		}

and onInit of 3rd page:

	onInit: function(oEvt) {
			var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
			oRouter.getRoute("empDetViewRoute").attachMatched(this._onRouteMatched, this);
			
		},
		_onRouteMatched: function(oEvt) {
				var oPernr = oEvt.getParameter("arguments");
				var filters = new sap.ui.model.Filter("pernr", sap.ui.model.FilterOperator.EQ, oPernr.selectedPERNR);
				var binding = this.byId("empOverTime").getBinding("items");
				binding.filter(filters);
			}
0 Kudos

Any clues...

Aison
Participant
0 Kudos

are you using the FlexibleColumnLayout as the view container? if so, you should remove the specified column before navigation. check the doc

Accepted Solutions (0)

Answers (2)

Answers (2)

Gautam_M
Participant
0 Kudos

Any updates..

venkateswaran_k
Active Contributor
0 Kudos

Hi

Please debug in following way.

var oPath = oEvt.getSource().getParent().getBindingContextPath();
   console.log(oPath)  "see here what value is coming
var oData = oModel.getProperty(oPath);
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
   console.log(oRouter)
oRouter.navTo("empDetViewRoute",{ PERNR : oData.pernr });

"put a break point in navTo function  - whether the page is identified here or not

Also check the page3 is not having error.. If any error in loading also will return back to page 2
irfan_gokak
Contributor
0 Kudos

Hi Pradeep,

Change view level for the 3rd view to "2".