我正在使用OData模型将UI控件绑定到GW服务.在服务元数据中,数据结构中有"FirstName"和"LastName".在UI上,比方说,我正在使用Label控件.
现在问题是如何直接使用OData模型将Label的Text属性绑定到"FullName"字符串(即"FirstName"+"LastName")?如果我使用JSON模型,我可以创建一个局部变量FullName = FirstName + LastName,并将Text属性绑定到FullName.但是我怎么能用OData模型呢?
我正在使用openui5.有一个UI控件的构造函数Button,无法看到Button的原型属性,但在浏览器控制台中执行时却出现同样的事情,显示出来!
sap.m.Button.prototype.Move = function(){
console.log('Move');
}
var oButton = new sap.m.Button({text:"Hello"});
oButton.Move(); // throws undefined function!
Run Code Online (Sandbox Code Playgroud)
在控制台中执行浏览器时相同的代码,它的工作原理!
jsbin - > http://jsbin.com/tepum/1/edit
SAPUI5中"依赖"聚合的实际使用情况是什么.
这是在1.9版本中添加的.它解决了什么问题?我在SCN网站上找不到太多关于此的文档.
在我们的应用程序中,我们加载了许多SAPUI5库.index.html具有以下代码来加载SAPUI5资源
<script src="resources/sap-ui-cachebuster/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons,sap.ui.table,sap.ui.ux3,sap.m"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-appCacheBuster="./">
</script>
Run Code Online (Sandbox Code Playgroud)
在我们的web.xml中,我们提到了https://sapui5.hana.ondemand.com作为com.sap.ui5.resource.REMOTE_LOCATION来加载资源.
我们观察到的是,应用程序第一次需要很长时间才能加载.并且网络调用给出了加载UI5资源需要最多时间的想法.有没有办法可以更快地加载UI5资源?还是在后台呢?建议或代码示例在这里真的很有帮助.谢谢.
有什么方法可以知道什么时候加载模型?
例:
sap.ui.controller("myapp.MyViewController", {
onInit: function() {
this.router = sap.ui.core.UIComponent.getRouterFor(this);
this.router.attachRoutePatternMatched(this._handleRouteMatched, this);
this.model = sap.ui.getCore().byId("app").getModel("mymodel");
},
onAfterRendering: function() {
console.log(this.model);
}
...
Run Code Online (Sandbox Code Playgroud)
在这种情况下,定义了模型实例,但它包含空对象,因为没有加载数据.
如果我用:包装console.log方法:
setTimeout(function() {
console.log(sap.ui.getCore().byId("app").getModel("mymodel"));
}, 0);
Run Code Online (Sandbox Code Playgroud)
然后模型数据被正确加载,但我想比使用setTimeout更可靠.
我们需要向OpenUI5添加新图标.图标已被定义为基于矢量的字体.
我知道可以通过https://icomoon.io/等服务将图标添加到SAP标准字体.但是,我希望能够将它们保存在一个单独的文件中(这样我们就不需要在新的OpenUI5版本出现时重做任务).
是否可以定义用于图标的其他字体?
我想这样在SAPUI5中转义此字符串。
var escapedLongText = escape(unescapedLongText);
Run Code Online (Sandbox Code Playgroud)
字符串(UTF-8引号,空格,Unicode引号)
”
转义字符串
%22%20%u201C
我想用此方法取消转义,但它返回空。有任何想法吗?
DATA: LV_STRING TYPE STRING.
LV_STRING = '%22%20%u201C'.
CALL METHOD CL_HTTP_UTILITY=>UNESCAPE_URL
EXPORTING
ESCAPED = LV_STRING
RECEIVING
UNESCAPED = LV_STRING.
Run Code Online (Sandbox Code Playgroud) 我使用SmartTable,属性useTablePersonalisation设置为true,按钮生成P13n对话框
.根据手册我应该能够更改过滤器操作符的数据类型:
第二个字段为操作员提供了更详细的指定过滤器.可用的运算符取决于所选列的数据类型.
我对手册中的这两个选项感兴趣:

我想获得"字符串类型"选项,它会自动生成:
但我仍然为"数字类型"而不是"字符串类型"自动生成选项.我在后端实体中将此字段声明为Edm.String.
请问你知道如何解决这个问题吗?
这是我的xml代码,Abc是Edm.String:
<smartTable:SmartTable id="idSmartTable" smartFilterId="idSmartFilterBar" tableType="ResponsiveTable" entitySet="AbcSet"
useVariantManagement="false" useTablePersonalisation="true" header=" " showRowCount="true" enableAutoBinding="true" useExportToExcel="false"
showFullScreenButton="true">
<Table growing="true" mode="None">
<columns>
<Column>
<customData>
<core:CustomData key="p13nData" value='\{"columnKey": "Abc","leadingProperty": "Abc","sortProperty": "Abc","filterProperty": "Abc"}'/>
</customData>
<header><Text text="{i18n>Abc}" wrapping="false"/></header>
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{Abc}"/>
</cells>
</ColumnListItem>
</items>
</Table>
</smartTable:SmartTable>
Run Code Online (Sandbox Code Playgroud)
我试图改变数据类型的"sap.ui.model.type.String" 的CustomData在XML表定义或ColumnListItem但也许我做错了什么.我必须使用1.38 UI5版本.
感谢您的任何设备.
我有一个基于 UI5 的应用程序 (1.66+),它可以正常工作,但屏幕左右两侧有巨大的空白区域(又名信箱打开):
我想禁用信箱以使用整个屏幕空间。
到目前为止,我尝试了以下方法:
"fullWidth": true在manifest.json 的sap.ui部分中使用<html class="sap-desktop sapUiMedia-Std-Desktop sapUiMedia-StdExt-LargeDesktop">
Run Code Online (Sandbox Code Playgroud)
appWidthLimited: false到index.html:<script>
sap.ui.getCore().attachInit(function () {
new sap.m.Shell({
app: new sap.ui.core.ComponentContainer({
height: "100%",
name: "APPNAME"
}),
appWidthLimited: false
}).placeAt("content");
});
</script>
Run Code Online (Sandbox Code Playgroud)
就像《如何在 SAPUI5 中自定义 Shell 容器》中描述的那样。
但它们都不适合我。
更新:
我成功地通过静态 XML 模板解决了这个问题——只需添加<Shell id="shell" appWidthLimited="false">到主 XML 模板中,但现在我想了解如何通过 JS 在new sap.m.Shell(…)定义中实现它。
代码实验的起点如下。
索引.html:
<!DOCTYPE html>
<html>
<head> …Run Code Online (Sandbox Code Playgroud) 我正在尝试按照sap.ui.table.TreeTable 中的 OData 示例将 OData 绑定到树表
我已经尝试了基本绑定与treeAnnotationPropertiesxml 中的设置和注释绑定(我已经检查了$metadata查询,它有sap:hierarchy-等)。
但是,两次我都得到重复的节点,例如:
Id | Title | Hierarchy Level | ParentID
----------------------------------------------------
1 | izparent | 0 | 0
|--1 | izparent | 0 | 0
| |-- ...
|--2 | izchild | 1 | 1
2 | izchild | 1 | 1
Run Code Online (Sandbox Code Playgroud)
我得到一个 ID 为 1 的节点,它是可扩展的,而节点 2 是不可扩展的。但是如果我展开节点 1,我再次得到可展开的节点 1 和节点 2,我可以重复展开节点 1 以获得相同的结果。
我有一种感觉,我有一个与此处类似的问题,但也没有为此提供答案:How to define tree table annotation (XML view)
我正在使用 …