"sap.ui5": {
(...)
"models": {
"": {
"dataSource": "mainService",
"preload": true,
"settings": {"defaultBindingMode": "TwoWay"}
}
}
}
onInit: function() {
this.getOwnerComponent().getModel().metadataLoaded().then((event) => {
// Create a new entry in the OData model
let oContextPersonal = this.getOwnerComponent().getModel().createEntry("/PersonalDataSet");
// Bind the new entry to the form Personal
this.getView().byId("idFormPersonal").bindElement(oContextPersonal.getPath());
this._tContextElement.push(oContextPersonal);
// Create a new entry in the OData model
let oContextAddress = this.getOwnerComponent().getModel().createEntry("/AddressSet");
// Bind the new entry to the form Address
this.getView().byId("idFormAddress").bindElement(oContextAddress.getPath());
this._tContextElement.push(oContextAddress);
});
},
onSubmitData: function() {
var oData = {
d: this._tContextElement[0].getObject()
};
oData.d.toAddress = {
results: [this._tContextElement[1].getObject()]
};
// Clean up the oData from __metadata attribute
delete oData.d.__metadata;
delete oData.d.toAddress.results[0].__metadata;
// Call backend
this.getView().getModel().create("/PersonalDataSet", oData);
}
{
"d" : {
principal EntityType
"associationName" : { child EntityType },
"associationName" : {
"results" : [
{
child EntityType
},
{
child EntityType
}
]
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
10 | |
9 | |
7 | |
4 | |
4 | |
3 | |
3 | |
2 | |
2 |