<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Routing with nested components SAPUI5 in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/routing-with-nested-components-sapui5/qaa-p/414781#M50149</link>
    <description>&lt;P&gt;I changed the "routes" and the "targets" section of the routing configuration. It now looks like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; "routes": [...
            {
            "pattern": "detail/{impttPath}",
            "name": "detail",
            "target": "detail",
            "parent": "master"&lt;BR /&gt;
            }
        ],
        "targets": {
            ...
            "detail": {
                "viewName": "DetailPage",
                "controlAggregation": "detailPages"
            }
        }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When calling the app via URL with the Pattern /master/0/detail/0 the routing mechanism works. (the pattern of the "master" route is "pattern": "master/{equiPath}" and is the parent of the "detail" route). The mistake must be in the onNavToDetail function. But by now i didn't figure out where.&lt;/P&gt;</description>
    <pubDate>Wed, 31 May 2017 13:33:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2017-05-31T13:33:25Z</dc:date>
    <item>
      <title>Routing with nested components SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/routing-with-nested-components-sapui5/qaq-p/414780</link>
      <description>&lt;P&gt;I have a question regarding routing in SAPUI5. I have a SplitApp container with two master views. The first master view displays a list of equipments. The second master view displays a list of measuringpoints of the chosen equipment. The data is (by now) located in a clientside JSON model wich looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;{
"Equipments": [
    {
        "EquipmentNr": "Equipment 0000000001",
        "Messpunkte": [
                {
                    "MesspunktNr": "Messpunkt 01"
                },
                {
                    "MesspunktNr": "Messpunkt 02"
                },
                {
                    "MesspunktNr": "Messpunkt 03"
                }
            ]
    },...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The detail page now should be able to access the "Messpunkt" chosen in the second masterview but I am not able to pass the parameters via routing. The routing configuration for routing to the detail view:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;            "routes": [...
            {
            "pattern": "master/{equiPath}/detail/{impttPath}",
            "name": "detail",
            "target": "detail"
            }
        ],
        "targets": {
            ...
            "detail": {
                "viewName": "DetailPage",
                "controlAggregation": "detailPages",
                "parent": "master"
            }
        }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am not sure how to call the navTo method in the controller of masterpage2 because when i try to it always gives me an error saying "The segment {equiPath} is required."&lt;/P&gt;&lt;P&gt;when calling the onNavToDetail method in this form:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;onNavToDetail : function(oEvent) {
			var oItem = oEvent.getSource();
			var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
			oRouter.navTo("detail", {
				equiPath: oItem.getBindingContext("equi").getPath().substr(0)
			});&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;i get the whole path e.g. "/Equipments/0/Messpunkte/0" for segment "{equiPath}&lt;/P&gt;&lt;P&gt;the information in the documentation "working with nested components" doesn't really help me. Thanks for ever help. Best wishes&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 09:34:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/routing-with-nested-components-sapui5/qaq-p/414780</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-05-31T09:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Routing with nested components SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/routing-with-nested-components-sapui5/qaa-p/414781#M50149</link>
      <description>&lt;P&gt;I changed the "routes" and the "targets" section of the routing configuration. It now looks like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; "routes": [...
            {
            "pattern": "detail/{impttPath}",
            "name": "detail",
            "target": "detail",
            "parent": "master"&lt;BR /&gt;
            }
        ],
        "targets": {
            ...
            "detail": {
                "viewName": "DetailPage",
                "controlAggregation": "detailPages"
            }
        }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When calling the app via URL with the Pattern /master/0/detail/0 the routing mechanism works. (the pattern of the "master" route is "pattern": "master/{equiPath}" and is the parent of the "detail" route). The mistake must be in the onNavToDetail function. But by now i didn't figure out where.&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 13:33:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/routing-with-nested-components-sapui5/qaa-p/414781#M50149</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-05-31T13:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Routing with nested components SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/routing-with-nested-components-sapui5/qaa-p/414782#M50150</link>
      <description>&lt;P&gt;Hi Benjimin,&lt;/P&gt;&lt;P&gt;First the Question "Nested Component Routing" is a bit misleading one :). It implies that you are using more than one sap ui5 components and using the routing between them and I hope you meant nested routing as i couldnt find anything about multiple components in your question.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Assuming you are talking about master-detail page navigation&lt;/STRONG&gt;, the SAP documentation, "working with nested components" you are referring is about something else completely which will not help you for your current requirement.&lt;/P&gt;&lt;P&gt;In the above configuration, you do not need to mention the parent, the routing should be like below:&lt;/P&gt;&lt;P&gt;You need to call the routing as mentioned in your code by passing the required keys..&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  "routes": [
            {
            "pattern": "",
            "name": "master1",
            "target": "master1"
            },

            {
            "pattern": "master2/{key1}",
            "name": "master2",
            "target": "master2"
            }

            {
            "pattern": "master2/{key1}/detail1/{key2}",
            "name": "detail1",
            "target": ["detail1", "master2"]
            }
        ],
        "targets": {

            "master1": {
                "viewName": "master1",
                "viewLevel": 1
            },
            "master2": {
                "viewName": "master2"
                "viewLevel": 2
            },

            "detail1": {
                "viewName": "detail1",
                "viewLevel": 3,
                "controlAggregation": "detailPages"
            }
        }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks &amp;amp; Best Regards,&lt;BR /&gt;Mahesh&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 16:09:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/routing-with-nested-components-sapui5/qaa-p/414782#M50150</guid>
      <dc:creator>maheshpalavalli</dc:creator>
      <dc:date>2017-05-31T16:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: Routing with nested components SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/routing-with-nested-components-sapui5/qaa-p/414783#M50151</link>
      <description>&lt;P&gt;Hi Mahesh,&lt;/P&gt;&lt;P&gt;thanks for your answer! I get the point.&lt;/P&gt;&lt;P&gt;But now i have the problem of how to pass the keys correctly. I am only able to catch {key2] with &lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;equiPath: oItem.getBindingContext("equi").getPath().substr(25)&lt;/CODE&gt;&lt;/PRE&gt;The Value with .substr(0) is: /Equipments/0/Messpunkte/0</description>
      <pubDate>Thu, 01 Jun 2017 05:40:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/routing-with-nested-components-sapui5/qaa-p/414783#M50151</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-06-01T05:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: Routing with nested components SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/routing-with-nested-components-sapui5/qaa-p/414784#M50152</link>
      <description>&lt;P&gt;Finally found a way to pass the parameters with regular expressions.&lt;/P&gt;&lt;P&gt;Here the code for the onNavToDetail function with a bit of console output for testing:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;onNavToDetail : function(oEvent) {
			var oItem = oEvent.getSource();
			var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
			
			var sPath = oItem.getBindingContext("equi").getPath();
			console.log(sPath);
			var regExpSpath = /([0-999])/g;
			var result = sPath.match(regExpSpath);
			console.log(result[0]);
			console.log(result[1]);
			
			oRouter.navTo("detail", {
				equiPath: result[0],
				impttPath: result[1]
			}); 
		}
&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Jun 2017 10:30:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/routing-with-nested-components-sapui5/qaa-p/414784#M50152</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-06-01T10:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Routing with nested components SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/routing-with-nested-components-sapui5/qaa-p/414785#M50153</link>
      <description>&lt;P&gt;you can also use split("/") to access the required data...&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;Mahesh&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 19:13:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/routing-with-nested-components-sapui5/qaa-p/414785#M50153</guid>
      <dc:creator>maheshpalavalli</dc:creator>
      <dc:date>2017-06-02T19:13:46Z</dc:date>
    </item>
  </channel>
</rss>

