I have redefined my App which is a Master-Detail app. The point is that I use a Main Entity Type with a relation to 3 entities. My question is:
In the Detail view I use a DynamicPage
with some info from Main entity (Name of Customer and so on...) an below, I show 3 tabs and in each tab, I am presenting the info by calling the navigation/association in the main entity/model, for example Header2Order/fieldx
.
In this particular Fragment:
<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>
I would like to create a new entry on the same view, for that, in my Detail.controller.js
, I am using:
_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
});
}
},
I am generating a proper Model based on the Entity extracted from the Navigation but I cannot link it to the Fragment properly cause I use {Header2Order/ValidTo}
instead {ValidTo}
and when I bind the new Context to the Element, it doesn't work.
I would like to know if you know a direct way to do it in this way or if it will be easier to extract the data from the call to the Association, generate a new Model in the context and bind it to the view/fragment.
Thanks!!