Skip to Content

SAPUI5 3 page navigation issue

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);
			}
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 07, 2017 at 02:24 PM

    Hi Pradeep,

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

    Add comment
    10|10000 characters needed characters exceeded