gpt4 book ai didi

javascript - OData服务数据绑定(bind)

转载 作者:行者123 更新时间:2023-11-30 16:51:31 26 4
gpt4 key购买 nike

我很难显示来自 OData 模型的数据。

这是模型声明:

var oModel = new sap.ui.model.odata.ODataModel("northwind/V2/(S(ql0iexfh2tyudc5p4qhx5gdf))/OData/OData.svc");
sap.ui.getCore().setModel(oModel, "odata");

我有一个 Northwind OData 服务的目的地,路径为“/northwind”。

这是我的列表声明:

var oResultsList = new sap.m.List(); 
var oListTemplate = new sap.m.StandardListItem({
path: "odata>/Categories",
title: "{odata>name}"
});
oResultsList.bindAggregation("items", "/", oListTemplate);

但我得到的是空列表。

如果我是正确的,我有一个到该服务的连接,因为我可以获得并查看该服务的元数据对象。

我的问题隐藏在哪里?

最佳答案

您的绑定(bind)似乎有误,例如该属性应该是 CategoryName 并且项目聚合需要针对实体集进行绑定(bind)。

var oListTemplate = new sap.m.StandardListItem({
description: "{odata>Description}",
title: "{odata>CategoryName}"
});
oResultsList.bindAggregation("items", "odata>/Categories", oListTemplate);

关于javascript - OData服务数据绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30454299/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com