<?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>topic Routing Issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/routing-issue/m-p/11903476#M1962499</link>
    <description>&lt;P&gt;Hello everyone, I am having problems with routing in my application. So basically I have, in my main page, a table with rows of data, each representing an entry in a JSON file. So first, find my manifest.json file and my employees.json file which represents my data. (I will omit the irrelevant parts of my manifest.json file). What I am trying to do, is implement parametrized routing, where clicking on a row will take me to a new page where the employee's information will show up.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt; "models": {

      "i18n": {
        "type": "sap.ui.model.resource.ResourceModel",
        "settings": {
          "bundleName": "sap.ui.demo.project.i18n.i18n"
        }
      },

      "employee": {
        "type": "sap.ui.model.json.JSONModel",
        "uri": "model/employees.json"
      }
    },

    "routing": {

      "config": {
        "routerClass": "sap.m.routing.Router",
        "viewType": "XML",
        "viewPath": "sap.ui.demo.project.view",
        "controlId": "app",
        "controlAggregation": "pages",
        "async": true,
        "bypassed": {
          "target": "notFound"
        }
      },

      "routes": [{
          "pattern": "",
          "name": "home",
          "target": "home"
        },
        {
          "pattern": "content",
          "name": "content",
          "target": "home"
        },
        {
          "pattern": "employee/{EmployeeID}",
          "name": "employee",
          "target": "employee"
        }
      ],
      "targets": {

        "home": {
          "viewId": "home",
          "viewName": "Home",
          "viewLevel": 1
        },

        "employee": {
          "viewName": "employee.Employee",
          "viewLevel": 2
        },

        "notFound": {
          "viewName": "NotFound",
          "transition": "show"
        }
      }

    },

&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;my employees.json file:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;{
  "Employees": [
    {
      "EmployeeID": 1,
      "Name": "Greg",
      "Position Title": "Vice Dean",
      "Campus": "",
      "Faculty": "",
      "Department": "",
      "Start Date": "2018.07.01",
      "End Date": "2019.04.04"
    },

    {
      "EmployeeID": 2,
      "Name": "Al Doe",
      "Position Title": "Chair",
      "Campus": "TBD",
      "Faculty": "Foo",
      "Department": "Bar",
      "Start Date": "2018.07.01",
      "End Date": "2019.04.04"
    },

    {
      "EmployeeID": 3,
      "Name": "John Doe",
      "Position Title": "TBD",
      "Campus": "",
      "Faculty": "",
      "Department": "",
      "Start Date": "2018.07.01",
      "End Date": "2019.04.04"
    }

]
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;My table renders fine, and I can click on each row, which takes me to a URL that ends with /employees/EmployeeID. The routing aspect is working fine, but here is the problem. When I arrive to the specific URL, I want to present data from that specific individual, which I try to do in a view file called Employee.view.xml: &lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;mvc:View
    controllerName="sap.ui.demo.project.controller.employee.Employee"
    xmlns="sap.m"
    xmlns:mvc="sap.ui.core.mvc"
    xmlns:f="sap.ui.layout.form"
    busyIndicatorDelay="0"&amp;gt;
    &amp;lt;Page 
        id="employeePage"
        title="{i18n&amp;gt;EmployeeDetailsOf} {Name}"
        showNavButton="true"
        navButtonPress="onNavBack"
        class="sapUiResponsiveContentPadding"&amp;gt;
    &amp;lt;/Page


&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;The {Name} part specifically does not render. If I remove it, I have a perfectly working page with {i18n&amp;gt;EmployeeDetailsOf} showing well, with a back button that takes me back to my table, so there are no XML issues (I have omitted a couple of lines here as well). I just can't get the employee name to show up, I even tried replacing {Name} with {employee&amp;gt;Name} but no luck there as well. I will attach my Table view, Table Controller and Employee Controller as well for reference (where the routing takes place).&lt;/P&gt;
  &lt;P&gt;Employee Controller:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;sap.ui.define([
    "sap/ui/demo/project/controller/BaseController"
], function (BaseController) {
    "use strict";
    return BaseController.extend("sap.ui.demo.project.controller.employee.Employee", {
        onInit: function () {
            var oRouter = this.getRouter();
            oRouter.getRoute("employee").attachMatched(this._onRouteMatched, this);
        },
        _onRouteMatched : function (oEvent) {
            var oArgs, oView;
            oArgs = oEvent.getParameter("arguments");
            oView = this.getView();

            oView.bindElement({
                path : "/employees(" + oArgs.EmployeeID + ")",
                events : {
                    change: this._onBindingChange.bind(this),
                    dataRequested: function (oEvent) {
                        oView.setBusy(true);
                    },
                    dataReceived: function (oEvent) {
                        oView.setBusy(false);
                    }
                }
            });
        },
        _onBindingChange : function (oEvent) {
            // No data for the binding
            if (!this.getView().getBindingContext()) {
                this.getRouter().getTargets().display("notFound");
            }
        }
    });
});

&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Table View (XML)&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;mvc:View controllerName="sap.ui.demo.project.controller.employee.EmployeeTable" 
    xmlns="sap.m" 
    xmlns:mvc="sap.ui.core.mvc"&amp;gt;

&amp;lt;Table id="empTable" inset="false" class="sapUiResponsiveMargin" width="auto" headerText="{i18n&amp;gt;employeeTableTitle}" items="{
         path : 'employee&amp;gt;/Employees',
         sorter : {
            path : 'Name' 
         }}"&amp;gt;

        &amp;lt;columns&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle" mergeDuplicates="true" width="10em" demandPopin="true"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnName}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnPosition}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnCampus}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle" width="20em" minScreenWidth="Tablet"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnFaculty}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle" width="20em" minScreenWidth="Tablet"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnDept}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnSDate}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnEDate}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
        &amp;lt;/columns&amp;gt;

        &amp;lt;items&amp;gt;
            &amp;lt;ColumnListItem press=".onPress" type="Navigation"&amp;gt;
                &amp;lt;cells&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;Name}" /&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;Position Title}" /&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;Campus}" /&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;Faculty}" /&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;Department}" /&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;Start Date}" /&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;End Date}" /&amp;gt;
                &amp;lt;/cells&amp;gt;
            &amp;lt;/ColumnListItem&amp;gt;
        &amp;lt;/items&amp;gt;

    &amp;lt;/Table&amp;gt;

&amp;lt;/mvc:View&amp;gt;

&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;and finally my table controller&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;sap.ui.define([
    "sap/ui/core/mvc/Controller",
    "sap/ui/model/Filter",
    "sap/ui/model/FilterOperator"
], function (Controller, Filter, FilterOperator) {
    "use strict";

    return Controller.extend("sap.ui.demo.project.controller.employee.EmployeeTable", {

        onInit: function () {
            
        },

        onPress: function (oEvent) {
            var oItem, oCtx;
            oItem = oEvent.getSource();
            oCtx = oItem.getBindingContext('employee');
            var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
            oRouter.navTo("employee", {
                EmployeeID: oCtx.getProperty("EmployeeID")
            });
        }

    });
});

&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I really hope someone can help me, I've been stuck on this for so long and I'm truly clueless about how to proceed next, having tried a lot. Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 14 Jun 2019 07:32:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2019-06-14T07:32:03Z</dc:date>
    <item>
      <title>Routing Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/routing-issue/m-p/11903476#M1962499</link>
      <description>&lt;P&gt;Hello everyone, I am having problems with routing in my application. So basically I have, in my main page, a table with rows of data, each representing an entry in a JSON file. So first, find my manifest.json file and my employees.json file which represents my data. (I will omit the irrelevant parts of my manifest.json file). What I am trying to do, is implement parametrized routing, where clicking on a row will take me to a new page where the employee's information will show up.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt; "models": {

      "i18n": {
        "type": "sap.ui.model.resource.ResourceModel",
        "settings": {
          "bundleName": "sap.ui.demo.project.i18n.i18n"
        }
      },

      "employee": {
        "type": "sap.ui.model.json.JSONModel",
        "uri": "model/employees.json"
      }
    },

    "routing": {

      "config": {
        "routerClass": "sap.m.routing.Router",
        "viewType": "XML",
        "viewPath": "sap.ui.demo.project.view",
        "controlId": "app",
        "controlAggregation": "pages",
        "async": true,
        "bypassed": {
          "target": "notFound"
        }
      },

      "routes": [{
          "pattern": "",
          "name": "home",
          "target": "home"
        },
        {
          "pattern": "content",
          "name": "content",
          "target": "home"
        },
        {
          "pattern": "employee/{EmployeeID}",
          "name": "employee",
          "target": "employee"
        }
      ],
      "targets": {

        "home": {
          "viewId": "home",
          "viewName": "Home",
          "viewLevel": 1
        },

        "employee": {
          "viewName": "employee.Employee",
          "viewLevel": 2
        },

        "notFound": {
          "viewName": "NotFound",
          "transition": "show"
        }
      }

    },

&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;my employees.json file:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;{
  "Employees": [
    {
      "EmployeeID": 1,
      "Name": "Greg",
      "Position Title": "Vice Dean",
      "Campus": "",
      "Faculty": "",
      "Department": "",
      "Start Date": "2018.07.01",
      "End Date": "2019.04.04"
    },

    {
      "EmployeeID": 2,
      "Name": "Al Doe",
      "Position Title": "Chair",
      "Campus": "TBD",
      "Faculty": "Foo",
      "Department": "Bar",
      "Start Date": "2018.07.01",
      "End Date": "2019.04.04"
    },

    {
      "EmployeeID": 3,
      "Name": "John Doe",
      "Position Title": "TBD",
      "Campus": "",
      "Faculty": "",
      "Department": "",
      "Start Date": "2018.07.01",
      "End Date": "2019.04.04"
    }

]
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;My table renders fine, and I can click on each row, which takes me to a URL that ends with /employees/EmployeeID. The routing aspect is working fine, but here is the problem. When I arrive to the specific URL, I want to present data from that specific individual, which I try to do in a view file called Employee.view.xml: &lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;mvc:View
    controllerName="sap.ui.demo.project.controller.employee.Employee"
    xmlns="sap.m"
    xmlns:mvc="sap.ui.core.mvc"
    xmlns:f="sap.ui.layout.form"
    busyIndicatorDelay="0"&amp;gt;
    &amp;lt;Page 
        id="employeePage"
        title="{i18n&amp;gt;EmployeeDetailsOf} {Name}"
        showNavButton="true"
        navButtonPress="onNavBack"
        class="sapUiResponsiveContentPadding"&amp;gt;
    &amp;lt;/Page


&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;The {Name} part specifically does not render. If I remove it, I have a perfectly working page with {i18n&amp;gt;EmployeeDetailsOf} showing well, with a back button that takes me back to my table, so there are no XML issues (I have omitted a couple of lines here as well). I just can't get the employee name to show up, I even tried replacing {Name} with {employee&amp;gt;Name} but no luck there as well. I will attach my Table view, Table Controller and Employee Controller as well for reference (where the routing takes place).&lt;/P&gt;
  &lt;P&gt;Employee Controller:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;sap.ui.define([
    "sap/ui/demo/project/controller/BaseController"
], function (BaseController) {
    "use strict";
    return BaseController.extend("sap.ui.demo.project.controller.employee.Employee", {
        onInit: function () {
            var oRouter = this.getRouter();
            oRouter.getRoute("employee").attachMatched(this._onRouteMatched, this);
        },
        _onRouteMatched : function (oEvent) {
            var oArgs, oView;
            oArgs = oEvent.getParameter("arguments");
            oView = this.getView();

            oView.bindElement({
                path : "/employees(" + oArgs.EmployeeID + ")",
                events : {
                    change: this._onBindingChange.bind(this),
                    dataRequested: function (oEvent) {
                        oView.setBusy(true);
                    },
                    dataReceived: function (oEvent) {
                        oView.setBusy(false);
                    }
                }
            });
        },
        _onBindingChange : function (oEvent) {
            // No data for the binding
            if (!this.getView().getBindingContext()) {
                this.getRouter().getTargets().display("notFound");
            }
        }
    });
});

&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Table View (XML)&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;mvc:View controllerName="sap.ui.demo.project.controller.employee.EmployeeTable" 
    xmlns="sap.m" 
    xmlns:mvc="sap.ui.core.mvc"&amp;gt;

&amp;lt;Table id="empTable" inset="false" class="sapUiResponsiveMargin" width="auto" headerText="{i18n&amp;gt;employeeTableTitle}" items="{
         path : 'employee&amp;gt;/Employees',
         sorter : {
            path : 'Name' 
         }}"&amp;gt;

        &amp;lt;columns&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle" mergeDuplicates="true" width="10em" demandPopin="true"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnName}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnPosition}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnCampus}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle" width="20em" minScreenWidth="Tablet"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnFaculty}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle" width="20em" minScreenWidth="Tablet"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnDept}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnSDate}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
            &amp;lt;Column hAlign="Center" vAlign="Middle"&amp;gt;
                &amp;lt;Text text="{i18n&amp;gt;columnEDate}" /&amp;gt;
            &amp;lt;/Column&amp;gt;
        &amp;lt;/columns&amp;gt;

        &amp;lt;items&amp;gt;
            &amp;lt;ColumnListItem press=".onPress" type="Navigation"&amp;gt;
                &amp;lt;cells&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;Name}" /&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;Position Title}" /&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;Campus}" /&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;Faculty}" /&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;Department}" /&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;Start Date}" /&amp;gt;
                    &amp;lt;Text text="{employee&amp;gt;End Date}" /&amp;gt;
                &amp;lt;/cells&amp;gt;
            &amp;lt;/ColumnListItem&amp;gt;
        &amp;lt;/items&amp;gt;

    &amp;lt;/Table&amp;gt;

&amp;lt;/mvc:View&amp;gt;

&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;and finally my table controller&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;sap.ui.define([
    "sap/ui/core/mvc/Controller",
    "sap/ui/model/Filter",
    "sap/ui/model/FilterOperator"
], function (Controller, Filter, FilterOperator) {
    "use strict";

    return Controller.extend("sap.ui.demo.project.controller.employee.EmployeeTable", {

        onInit: function () {
            
        },

        onPress: function (oEvent) {
            var oItem, oCtx;
            oItem = oEvent.getSource();
            oCtx = oItem.getBindingContext('employee');
            var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
            oRouter.navTo("employee", {
                EmployeeID: oCtx.getProperty("EmployeeID")
            });
        }

    });
});

&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I really hope someone can help me, I've been stuck on this for so long and I'm truly clueless about how to proceed next, having tried a lot. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 07:32:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/routing-issue/m-p/11903476#M1962499</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-06-14T07:32:03Z</dc:date>
    </item>
  </channel>
</rss>

