- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
由于声明的变量(idno,namecity)位于括号内,我无法从外部访问它们。这是获得值(value)的方式还是最好的方式?谢谢您
<script>
var app = sap.m.App("myApp",{});
var url = "proxy/http/server/ZCUST_TESTING_SRV /?$filter=IKunnr eq '800COL101'";
var username = "mobtest";
var password = "welcome1";
var oModel = new sap.ui.model.odata.ODataModel(url, true, username, password);
oModel.read('/', null, null, true, function(oData, oResponse)
{
var dataget = JSON.stringify(oData);
var count = oData.results[0].Ort01;
var namecity= oData.results[0].Name1;
var idno= oData.results[0].Kunnr;
});
var l4 = new sap.m.Label("l4",{text: count});
var l5 = new sap.m.Label("l5",{text: namecity});
var l6 = new sap.m.Label("l6",{text: idno});
var page = new sap.m.Page("page",{
title:"Address Details",
showNavButton:true,
navButtonTap: function(){
//app.back();
app.to("Page");
},
content: [ l4,l5,l6, new sap.m.Button({text:"submit" }})]
});
app.addPage(page);
app.placeAt('content');
</script>
最佳答案
根据您问题评论中的讨论,我为您整理了一个更合适地使用 ODataModel 的示例,而不是与之对抗,不必进行显式读取,也不必访问结果
直接获取属性,而不是手动捕获检索到的数据并将其放入新的 JSON 模型中。
基本上,实例化 ODataModel,在控件属性上使用绑定(bind)语法,并设置适当的绑定(bind)上下文以便解析相对路径。
Here's the JS Bin example 。我用 XML 编写了 UI 控件,因为它更简洁,并使用了 Northwind 模型,但在其他方面尝试保持最初的目标。
以下是该示例的一些片段:
<App>
<Page
binding="{/Employees(1)}"
title="Address Details"
showNavButton="true">
<content>
<Label text="{TitleOfCourtesy}" />
<Label text="{FirstName}" />
<Label text="{LastName}" />
</content>
</Page>
</App>
注意页面上的绑定(bind)以及标签文本属性中的绑定(bind)。
oView
.setModel(new sap.ui.model.odata.ODataModel(
"http://cors-anywhere.herokuapp.com/http://services.odata.org/V3/Northwind/Northwind.svc/",
{
json : true,
maxDataServiceVersion : "2.0"
}
))
注意 ODataModel 的设置方式,并注意没有任何 read()
调用,没有任何 try catch 和存储数据的回调成功处理程序,并且没有任何帮助程序JSON 模型。 (此外,我正在使用非常有用的 cors-anywhere 服务,因此我们可以查看远程 OData 服务的示例,而无需使用代理等)。
关于javascript - 我想将值传递给使用 odata 的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25486738/
我在本地创建了一个 OData 应用程序。请求地址为“http://localhost:5182/odata/Users” [EnableQuery] public IHttpActionR
有可用的使用 WCF 数据服务(ADO.NET 数据服务)的 OData 服务。我需要以编程方式使用 OData 服务。从某种意义上说,我不想使用 DataSvcUtil 创建代理。相反,我需要在运行
这是设置:我有一个“学生”,他有一个相关的实体“类(class)”(一对多)。每个“类(class)”都有一个相关实体“期间”,其中包含类(class)的所有时间和日期详细信息。我想找回所有在 201
我想知道是否有或为什么没有用于 Java 的 ADO.NET 数据服务服务器库? 我需要从 Java 服务器公开数据库,但我只看到 Microsot 为 Java 提供客户端,而不是服务器部分。 当您
我正在使用 odata api,现在我在一个实体上有一个属性,它是一个选项,如下所示: 属性名称是:status值为:1、2、3名称:完成,进度,新 问题是当我使用 postman 获取元数据时,我得
处理文件流 GET、POST 和 DELETE 操作的推荐方法是什么。我得到了以下有关如何操作的链接,但它适用于 V3 版本。在将此解决方案移植到 OData V4 伊朗时,会产生一系列问题,这些问题
我对 Odata 主题很陌生,并尝试了解使用 OData 服务时的最佳实践方案是什么。 方案 1: 我有一个复杂的应用程序,其中包含来自远程 Odata 模型的多个 EntitySet,该模型是从 S
OData 被吹捧为 REST 样式数据服务的新开放标准,但我找不到太多证据表明它被任何未加入 MSFT 开发人员社区的人愤怒地使用。如果它是一个开放标准,我会期待 Java/Ruby/Python/
我正在创建分页并每页获取 10 条 JSON 记录: var coursemodel = query.Skip(skip).Take(take).ToList(); 我需要在网页上显示数据库中可用
我正在尝试使用此 URL 在 OData 中进行一些自定义排序 localhost:82/odata.svc/ComponentPresentations?$filter=TemplateId eq
给定一个已知的 OData 端点,确定 OData 服务版本的最佳方法是什么?此场景中的客户端可以支持任何版本(1-4),但我需要知道如何格式化请求。 例如,OData-Version为 V4 服务返
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 6年前关闭。 Improve thi
我的应用程序的 Controller 大多调用一个数据源,没有任何问题。 但是,其中之一使用三个单独的数据源,有时在访问它们时会返回 403 Forbidden 错误。 "dataSources":
在我的职业生涯中,我已经使用过OData了很多,现在,来自不同团队的同事中很少有人建议我们使用JsonAPI和GraphQL,因为它与Microsoft无关。我对这两种查询语言都没有太多的经验。据我所
我正在尝试创建对 odata webservice 的调用,该调用将仅选择某些属性的不同值。有没有很好的例子说明如何做到这一点? 最佳答案 目前,OData 协议(protocol)不支持 disti
我必须对名称包含空格的字段进行 $filter 查询。例如,$filter=票号,例如“abc_123” 我开始认为这是不可能的。有人可以帮我解决这个问题吗? 谢谢。 最佳答案 我想分享这个,我试图通
我正在开发一个需要与 OData 服务(确切地说是 Microsoft Dynamics CRM)通信的应用程序。我有一个要求,我只需要知道实体具有哪些所有属性。 例如 [Organization U
我正在尝试访问 OData 源提供程序,特别是 SAP HANA 通过 Odata 服务公开的分析 View 。我正在 odata 上应用包含数字的过滤器,但收到一条错误消息,指出不支持使用该数字,因
我正在创建一个 SAPUI5 应用程序。此应用程序通过 OData 连接到后端 SAP 系统。在 SAPUI5 应用程序中,我使用了智能图表控件。开箱即用的智能图表允许用户为基础数据创建过滤器。这工作
我已使用 this generator 成功生成 OData 客户端代码访问我的 Dynamics CRM WebApi 服务。不幸的是,对于一个普通的组织,它生成了一个 ~30 MB 的 cs 文件
我是一名优秀的程序员,十分优秀!