Skip to Content
0

SAPUI5 3 page navigation issue

Dec 06, 2017 at 05:08 PM

62

avatar image

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

Any clues...

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Irfan Gokak Dec 07, 2017 at 02:24 PM
0

Hi Pradeep,

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

Share
10 |10000 characters needed characters left characters exceeded