on 07-03-2019 8:37 AM
Hi Manohar R,
You might want to look at Routing which you defined. If you want to show id in URL, you need to define routing in manifest.json which looks like you have already done.
Format should be like below:
{
"name": "BlankPage",
"pattern": "/blank/{id}",
"titleTarget": "",
"greedy": false,
"target": [
"BlankPage"
]
}
To get this value:
_routeMatched: function (e) {
pathVal = e.getParameter("arguments").id;
},
OR
Please try below working code:
Routing in manifest.json:
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "SAPOpenCourse.com.view",
"controlId": "app",
"controlAggregation": "pages",
"async": true,
"bypassed": {
"target": "notFound"
}
},
"routes": [
{
"pattern": "",
"name": "view1",
"target": "View1"
},
{
"name": "prod_details",
"pattern": "prod_details",
"titleTarget": "",
"greedy": false,
"target": [
"prod_details"
]
}
],
"targets": {
"View1": {
"viewID": "view1",
"viewName": "View1"
},
"prod_details": {
"viewId": "prod_details",
"viewName": "prod_details"
},
"notFound": {
"viewName": "notFound",
"transition": "show"
}
}
},
View1.xml
Please remove unwanted code per your requirements.
<List selectionChange="onItemSelected" mode="SingleSelectMaster" noDataText="{i18n>noDataText}" id="lstProducts" items="{ path: '/ProductSet', sorter: { path: 'Category', group: true }, parameters: { expand: 'ToSupplier,ToSalesOrderLineItems' } }"
growing="true" growingThreshold="5" growingScrollToLoad="true">
<headerToolbar>
<Toolbar>
<Title text="Available Products"/>
<ToolbarSpacer/>
<SearchField width="50%" search="onFilterProducts"/>
</Toolbar>
</headerToolbar>
<items> <ObjectListItem type="Navigation" title="{Name} ( {ProductID} )" intro="{Category}" number="{CurrencyCode} {Price}" numberState="{= ${Price} > 500 ? 'Error' : 'Success'}"> <attributes> <ObjectAttribute text="{WebAddress}" id="__attribute4"/> </attributes> <firstStatus> <ObjectStatus text="{ parts: [ {path: 'WeightUnit'}, {path: 'WeightMeasure'} ], formatter : '.formatter.delivery' }"/> </firstStatus> <secondStatus> <ObjectStatus text="{ parts: [ {path: 'SupplierName'}, {path: 'Name'}, {path: 'TypeCode'} ] }"></ObjectStatus> </secondStatus>
</ObjectListItem></items>
</List>
View1.controller.js
onItemSelected: function(oEvent){
var oComponent;
oComponent=null;
oComponent = sap.ui.component(sap.ui.core.Component.getOwnerIdFor(this.getView()));
var oSelectedItem = oEvent.getParameter("listItem");
var oContext = oSelectedItem.getBindingContext();
var sPath = oContext.getPath();
var oPnlControl = this.byId("pnlData");
oPnlControl.bindElement({path:sPath});
oPnlControl.setVisible(false);
//var obj = oContext.getObject();
//this.router.navTo("prod_details", {
// ProductID: obj.ProductID
//});
oComponent._setLineItem(sPath, true);
MessageToast.show(sPath);
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo("prod_details");
},
Hope this helps..
Thanks-
Abhishek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.