on 08-12-2015 11:34 AM
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
Hi Durga,
Hope this example helps - JS Bin - Collaborative JavaScript Debugging
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you use JSon Model how you will get the data
(its client side model ).so use odata model and bind aggregation,
Binding oData into table(sap.m.table) in SAPUI5 | SCN
SAPUI5 Table binding with ODATA model. | SCN
OData Model and Data Binding | SCN
http://stackoverflow.com/questions/27166691/sapui5-multimodel-binding
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you binded your table??
Use like this.
oTable.bindRows("products>/Products");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I will suggest one more thing, if you are testing it in localhost then use URL with proxy like below.
var oModel = new sap.ui.model.json.JSONModel("proxy/http/services.odata.org/V3/Northwind/Northwind.svc/Customers?$format=json");
Which browser you are using??
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.