Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3280

How to access data from multiple models

$
0
0

Hi

 

I am trying to create couple of oData models in my control.

 

 

var oModel = new sap.ui.model.json.JSONModel("http://services.odata.org/V3/Northwind/Northwind.svc/Customers?$format=json"); 

  sap.ui.getCore().setModel(oModel,"customers");

 

  var oModel1 = new sap.ui.model.json.JSONModel("http://services.odata.org/V3/Northwind/Northwind.svc/Products?$format=json"); 

  sap.ui.getCore().setModel(oModel1,"products");

 

I am trying to access the value of these odata models like below

 

 

var otemplate = new sap.ui.commons.TextView({text:"{customers>ContactName}"})

  oTable.addColumn(new sap.ui.table.Column({

   label: new sap.ui.commons.Label({text: "Contact Name"}),

   visible: true,

   template: otemplate  

  })); 

  var oControl = new sap.ui.commons.TextView({text:"{customers>ContactTitle}"})

  oTable.addColumn(new sap.ui.table.Column({

   label: new sap.ui.commons.Label({text: "Contact Title"}),

   visible: true,

   template: otemplate

  }));

 

I am unable to success, and my browser not throwing any errors.

 

Anyone help?

 

Thanks

Prasad


Viewing all articles
Browse latest Browse all 3280

Trending Articles