我想从ui5中创建一个条目及其子对象,所以我使用了创建条目的方法,问题是我希望用户能够更新子节点的值,所以我执行了以下操作
var oParentContext = this._oODataModel.createEntry("/Parent",
{ changeId: "edit", properties: {object}, success: this._fnEntityCreated.bind(this), error: this._fnEntityCreationFailed.bind(this) });
for (var i = 0; i < childArray.length; i++) {
var child = childArray[i];
aChildCtx = this._oODataModel.createEntry("/child", {
changeId: "edit",
properties: child,
context: oParentContext
});
aChildEntries.push(aChildCtx.getPath().substring(1));
}
this.getView().setBindingContext(oParentContext);
// I attached also the relation to the front end
this.getView().getModel().setProperty("ToChild", aChildEntries, oParentContext);
在视图中,我将ToChild关系绑定到表,以供用户输入其值。
父级和子级的显示有效,但是我遇到了一个问题,即视图正在使用临时ID / ToChild向Odata发出get请求。我找不到任何解决方案。我们应该如何在标准中进行深层插入?
P.S。我不想使用deep_create
谢谢
最好的问候
当前正在异步创建创建请求。确定的父级ID仅在父级创建请求返回时才在前端中知道,但是在此之前会生成创建子级的请求。
我可以看到两种方法来确保将使用确定的父代ID创建子代: