sapui5 - 来自关联/导航的 createEntry()
问题描述
我重新定义了我的应用程序,它是一个主从应用程序。关键是我使用与 3 个实体相关的主实体类型。我的问题是:
在详细信息视图中,我使用DynamicPage
来自主要实体(客户名称等...)的一些信息,在下面,我显示 3 个选项卡,在每个选项卡中,我通过调用主实体中的导航/关联来呈现信息实体/模型,例如Header2Order/fieldx
.
在这个特定的片段中:
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:smartForm="sap.ui.comp.smartform" xmlns:smartField="sap.ui.comp.smartfield" xmlns:form="sap.ui.layout.form" xmlns:l="sap.ui.layout" xmlns:app="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1">
<VBox class="sapUiSmallMargin" id="VBox">
<smartForm:SmartForm id="smartForm" editTogglable="false" title="{i18n>TITLE}"
editable="{screenSetup>/bEditable}">
<smartForm:Group>
<smartForm:GroupElement label="{i18n>Order}" id="groupElementOrder">
<smartField:SmartField value="{Header2Order/OrderTxt}" tooltipLabel="{i18n>ORDERTXT}" id="smartFieldOrderTxt">
<smartField:configuration>
<smartField:Configuration preventInitialDataFetchInValueHelpDialog="false"/>
</smartField:configuration>
</smartField:SmartField>
</smartForm:GroupElement>
<smartForm:GroupElement label="{i18n>VALID_FROM}" useHorizontalLayout="true" id="groupElementValidFrom">
<smartField:SmartField id="smartFieldValidFrom" value="{Header2Order/ValidFrom}" tooltipLabel="{i18n>VALID_FROM}"/>
</smartForm:GroupElement>
<smartForm:GroupElement label="{i18n>VALID_TO}" useHorizontalLayout="true" id="groupElementValidTo">
<smartField:SmartField id="smartFieldValidTo" value="{Header2Order/ValidTo}" tooltipLabel="{i18n>VALID_TO}"/>
</smartForm:GroupElement>
<smartForm:GroupElement id="groupElementText" label="{i18n>COMMENT}">
<smartField:SmartField id="smartFieldText" value="{Header2Order/Comment}" app:multiLineSettings="{cols: 100, rows: 4}"/>
</smartForm:GroupElement>
</smartForm:Group>
</smartForm:SmartForm>
</VBox>
</core:FragmentDefinition>
我想在同一个视图上创建一个新条目,为此Detail.controller.js
,我正在使用:
_createNewComment: function () {
if (view.byId("iconTabBar").getBindingContext() !== null) {
this._sBindingPath = null;
this._sBindingPath = view.byId("iconTabBar").getBindingContext().getPath();
var sBinding = this._sBindingPath + "/Header2Order"
this._oContext = view.getModel().createEntry(sBinding, {
properties: this._setODataDefaulted()
});
sBinding = this._oContext.getPath() + "/Header2Order"; " Binding the Relative Path??
view.byId("iconTabBar").bindElement({
path: this._oContext.getPath(),
model: sBinding
});
}
},
我正在根据从导航中提取的实体生成一个正确的模型,但我无法将其正确链接到片段,因为我使用了它,{Header2Order/ValidTo}
并且{ValidTo}
当我将新上下文绑定到元素时,它不起作用。
我想知道您是否知道以这种方式执行此操作的直接方法,或者是否更容易从对关联的调用中提取数据,在上下文中生成一个新模型并将其绑定到视图/片段。
谢谢!!
解决方案
推荐阅读
- amazon-web-services - 标签被 Terraforms aws_vpc 数据源错误格式化
- angular - 在 Angular Arrayform 上使用 [formGroup]
- python-pptx - python-pptx:更改饼图的边框宽度
- google-apps-script - 仅在 google sheet 中生成子文件夹列表
- python - 熊猫插值“时间”与“线性”
- django - Django:如何覆盖模型字段的详细名称和帮助文本
- php - 在 Woocommerce 变量产品下拉列表中隐藏变体属性值
- python - matplotlib 堆积条形图的工具提示
- python - VS Code:如何制作一个 python 片段,在字符串或表达式点击选项卡后将对其进行转换
- dependency-injection - .net 核心方法依赖注入