Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2106

Selection and Master-Detail Routing

$
0
0

Hey there

 

I have an app which first you have a selectionscreen where you select your order id. After you selected the Order you'll get to an Master-Detail View with all Order Positions of that order in the master, and in the detail the approval.

 

I tried different version to achieve this, but none of those worked.

 

First my Setup:

 

mainfest.json:

"rootView": {  "viewName": "ch.test.view.Main",  "type": "XML"  },
[....]
"routing": {  "config": {  "viewPath": "ch.test.view",  "routerClass": "sap.m.routing.Router",  "viewType": "XML",  "transition": "slide",  "bypassed": {  "target": "notFound"  },  "targetAggregation": "detailPages",  "clearTarget": false  },  "routes": [  {  "name": "Selection",  "pattern": "",  "target": ["Selection"]  },   {  "name": "OrderPosition_Master",  "pattern": "Order/{order_id}",  "target": ["OrderPosition_Detail", "OrderPosition_Master"]  },   {  "name": "OrderPosition_Detail",  "pattern": "Order/{order_id}/{orderposition_id}",  "target": ["OrderPosition_Detail", "OrderPosition_Master"]  },   {  "name": "SplitContainer",  "pattern": "Order2",  "target": "SplitContainer",  "subroutes": [  {  "pattern": "Order2/{order_id}",  "name": "Master",  "target": "Master",  "subroutes": [  {  "pattern": "Order2/{order_id}/{orderposition_id}",  "name": "Detail",  "target": "Detail"  }  ]  }  ]  }  ],  "targets": {  "Detail": {  "viewName": "OrderPosition_Detail",  "targetAggregation": "detailPages",  "targetControl": "splitContainer"  },  "Master": {  "viewName": "OrderPosition_Master",  "targetAggregation": "masterPages",  "targetControl": "splitContainer",  "controlAggregation": "masterPages",  "controlId": "splitContainer"  },  "SplitContainer": {  "viewName": "SplitContainer",  "targetControl": "app",  "targetAggregation": "pages",  "controlAggregation": "pages",  "controlId": "app"  },  "Selection": {  "viewName": "Selection",  "viewLevel": 1,  "controlAggregation": "pages",  "controlId": "app"  },  "notFound": {  "viewName": "NotFound",  "viewLevel": 1,  "controlAggregation": "pages",  "controlId": "app"  },  "OrderPosition_Master": {  "viewName": "OrderPosition_Master",  "viewLevel": 1,  "controlAggregation": "masterPages",  "controlId": "appSplit"  },  "OrderPosition_Detail": {  "viewName": "OrderPosition_Detail",  "viewLevel": 2,  "controlAggregation": "detailPages",  "controlId": "appSplit"  }  }  }

Main.view.xml

<mvc:View xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">  <App id="app">  </App></mvc:View>

SplitContainer.view.xml

<mvc:View xmlns:core="sap.ui.core" xmlns:html="http://www.w3.org/1999/xhtml"  xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">  <SplitContainer  id="splitContainer">  </SplitContainer></mvc:View>

OrderPosition_Master.view.xml

<mvc:View xmlns:core="sap.ui.core" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns:semantic="sap.m.semantic" xmlns="sap.m" controllerName="ch.bkw.controller.OrderPosition_Master">  <semantic:MasterPage id="page" navButtonPress="onNavBack" showNavButton="true" title="Masterview">  <semantic:content>  <!-- For client side filtering add this to the items attribute:  parameters: {operationMode: 'Client'}}" -->  <List growing="true" items="{/OrderSet}" growingScrollToLoad="true" id="list" mode="{= ${device&gt;/system/phone} ? 'None' : 'SingleSelectMaster'}" selectionChange="onSelectionChange" updateFinished="onUpdateFinished">  <items>  <ObjectListItem numberUnit="{Ernam}" press="onSelectionChange" title="{Matnr}" type="{= ${device&gt;/system/phone} ? 'Active' : 'Inactive'}"/>  </items>  </List>  </semantic:content>  </semantic:MasterPage></mvc:View>

OrderPosition_Detail.view.xml

<mvc:View xmlns:core="sap.ui.core" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:sap.m.semantic="sap.m.semantic" controllerName="ch.bkw.controller.OrderPosition_Detail"><sap.m.semantic:DetailPage xmlns:sap.m.semantic="sap.m.semantic" title="Semantic Page" id="__page0">    <sap.m.semantic:content>        <Button text="Button" width="100px" id="__button1"/>    </sap.m.semantic:content></sap.m.semantic:DetailPage></mvc:View>

If I then navigate to

domain.com#/Order2/1234 I get following error:

Control with ID splitContainer could not be found - EventProvider sap.m.routing.Target

Uncaught TypeError: Cannot read property 'oTargetControl' of undefined

Cannot read property 'SplitContainer' of null

 

I think this is because I've set the RootView to the App Control not to the SplitContainer. Any other way to achieve this selection to masterdetail navigation?

 

Thanks and Regards

Fabian


Viewing all articles
Browse latest Browse all 2106

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>