Reputation: 1826
I have a hard time with displaying data from OData model.
Here is the model declaration:
var oModel = new sap.ui.model.odata.ODataModel("northwind/V2/(S(ql0iexfh2tyudc5p4qhx5gdf))/OData/OData.svc");
sap.ui.getCore().setModel(oModel, "odata");
I have a destination for Northwind OData service with path "/northwind".
Here is my list declarations:
var oResultsList = new sap.m.List();
var oListTemplate = new sap.m.StandardListItem({
path: "odata>/Categories",
title: "{odata>name}"
});
oResultsList.bindAggregation("items", "/", oListTemplate);
But I get empty list.
If I'm correct, I have a connection to the service, because I can get and see the metadata object of this service.
Where my problem is hiding?
Upvotes: 1
Views: 797
Reputation: 4231
Your binding seems to be erroneous, e.g. the property should be CategoryName and the item aggregation needs to be bound against the entity set.
var oListTemplate = new sap.m.StandardListItem({
description: "{odata>Description}",
title: "{odata>CategoryName}"
});
oResultsList.bindAggregation("items", "odata>/Categories", oListTemplate);
Upvotes: 2