cancel
Showing results for 
Search instead for 
Did you mean: 

Odata with $expand (Northwind) (Display Categories with Products)

Former Member
0 Kudos

Hi Experts

I am doing a test, and is not completely working....  I am displaying a table with the content of the Categories from the Northwind,  with the $expand=Products, To get the products linked to the categories... On the table I can get to display the info from the categories but not the info for the products.

This is the code... You are welcome to test it

<!DOCTYPE HTML>

<html>

  <head>

  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

  <script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"

  id="sap-ui-bootstrap"

  data-sap-ui-libs="sap.m,sap.ui.table"

  data-sap-ui-theme="sap_bluecrystal">

  </script>

  <!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->

  <script>

  var url = "proxy/http/services.odata.org/Northwind/Northwind.svc/";

  var oModel = new sap.ui.model.odata.ODataModel(url, true);

  sap.ui.getCore().setModel(oModel);

  var oTable = new sap.ui.table.Table("table", { // create Table UI

  title: "Northwind - Orders",

  columns : [

  {label: "Description", template: "Description"  },  

  {label: "Category Name", template: "CategoryName" },

  {label: "Category ID", template: "CategoryID"},

  {label: "Product ID", template: "Products/ProductID"},

  {label: "Supplier ID", template: "Products/SupplierID"},

  {label: "Produc tName", template: "Products/ProductName"}

  ]

  });

  oTable.bindRows({

  path: "/Categories",

  parameters: {

    select:"Description,CategoryName,CategoryID,Products/ProductID,Products/SupplierID,Products/ProductName",

  expand:"Products"

  }

  }); // bind the table rows

  oTable.placeAt("content"); // place Table onto UI

  </script>

  </head>

  <body class="sapUiBody" role="application">

  <div id="content"></div>

  </body>

</html>

Any ideas?

Regards

Henry

Accepted Solutions (0)

Answers (1)

Answers (1)

kai2015
Contributor
0 Kudos

How can I test it?

Read this please: