Skip to Content
0
Former Member
May 11, 2016 at 12:28 PM

Problem on navigating from one view to another in SAP UI5 application

466 Views

Hello All,

As per my requirement I have created the split app using SAP UI5 controls in hcp. And in the detail side, I have the table which list the service tickets from there I would like to navigate to another view (Service detail - custom view created).

For this routing and navigation, I have set the routing infor and configurations in manifest.json as like below:

"routing": {

"config": {

"routerClass": "sap.m.routing.Router",

"viewType": "XML",

"viewPath": "SplitApp.view",

"controlId": "idAppControl",

"bypassed": {

"target": []

},

"async": true

},

"routes": [

{

"pattern": "",

"name": "splitapp",

"controlAggregation": "detailPages",

"target": "SplitApp"

},

{

"pattern": "srvdetail/{ID}",

"name": "srvdetail",

"target": ["splitapp" , "srvdetail"]

}

],

"targets": {

"splitapp": {

"viewName": "SplitApp",

"viewId": "SplitApp",

"viewLevel": 1

},

"srvdetail": {

"viewName": "SrvDetail",

"viewId": "srvdetail",

"viewLevel": 2

},

"objectNotFound": {

"viewName": "ObjectNotFound",

"viewId": "objectNotFound"

},

"notFound": {

"viewName": "NotFound",

"viewId": "notFound"

}

}

}

Then in the controller of initial view, inside the onpress event, I have set the binding context and and the value selected got filled. But on exectuing last line its shows error as "The segment {ID} is required."

this._router = sap.ui.core.UIComponent.getRouterFor(this);

var oBindContext = oEvent.getSource().getBindingContext();

var oModel = oBindContext.getModel();

// var oRouter = sap.ui.core.UIComponent.getRouterFor(this);

var sObjectID = oModel.getData(oBindContext.getPath()).ID;

this._router.navTo("srvdetail", {Id: sObjectID});

Please post your suggestions on this.

Regards

Swadini S