绑定到 Master-Detail 应用程序中的元素时出现 OData 错误
OData error when bind to an element in a Master-Detail app
我开发了一个 Master-Detail 应用程序。在详细信息视图中,我在内容中使用 DynamicPage,我使用 IconTabBar 元素和 3 个项目。每个项目都是不同的 Fragment,带有 Smartform。
主视图正在从 EntitySet 加载数据 (MasterEntity)
具有 的详细视图正在使用实体 MasterEntity[=13 中的一些字段=]
片段 1:正在使用 DetailEntitySet
片段 2:正在使用 DetailEntitySet
片段 3:正在使用 DetailEntitySet
基本上,当 Detail View Controller 正在检测 RouteMatch 时,我在 Master View 上接收到选定的行,并将其绑定到 View Detail。完成后,我将检查视图是否已生成,然后调用一种方法将 Expanded 实体绑定到 iconTabBar 元素,其中包含3个片段。代码如下:
function _onRoutePatternMatched(event) {
if (event.getParameter("name") === "detail") {
var path = event.getParameter("arguments").contextPath;
if (path !== " ") {
var path2 = "/" + path;
view.bindElement(path2);
if (view) {
this._setBindingToIconTab("Master2Detail");
}
} else {
view.unbindElement();
}
}
}
_setBindingToIconTab函数如下:
_setBindingToIconTab: function (sAssociation) {
view.byId("iconTabBar").bindElement(sAssociation);
}
iconTabBar 是我在详细信息视图中分配给 IconTabBar 元素的 ID。
问题是,当我执行它并加载第一个片段时,一切正常。在第二个和第三个中,我得到了错误(但显示了值......)。当它们在屏幕上被选中时,我正在加载片段。如果它们没有生成,我将它们实例化并存储在一个数组中。我得到的错误是:
Assertion failed: The EDM property "DateFrom" was not found in the "ZZODATA_TEST_SRV.Master" entity type. -
sap.ui.comp.smartfield.ODataControlFactory
它抱怨来自 DetailEntitySet 的字段不在 MasterEntitySet 中。
你能帮我处理一下吗?
因为没有 XML、运行 示例等。我无法告诉您为什么会出现此错误,但是..
最佳做法是在详细视图中也将所选实体展开为详细信息等
MasterEntitySet->DetailEntitySet
由于绑定会传播到子项,因此无需再次绑定 iconTabBar。数据已经存在。同样,我不知道你的情况,但大多数服务看起来像这样
MasterEntitySet->DetailEntitySet->DataVariantA(ForIconTab1)
->DataVariantB(ForIconTab2)
->DataVariantC(ForIconTab3)
在 V4 中,您的详细代码如下所示
oView.bindObject({
path: "/MasterEntity(" + this._args.ID + ")",
parameters: {
$expand:`DetailEntityNavPath($expand=DataVariantANavPath()...`
},
events: {
dataReceived: (oEvent) => {...
我开发了一个 Master-Detail 应用程序。在详细信息视图中,我在内容中使用 DynamicPage,我使用 IconTabBar 元素和 3 个项目。每个项目都是不同的 Fragment,带有 Smartform。
主视图正在从 EntitySet 加载数据 (MasterEntity)
具有 的详细视图正在使用实体 MasterEntity[=13 中的一些字段=]
片段 1:正在使用 DetailEntitySet
片段 2:正在使用 DetailEntitySet
片段 3:正在使用 DetailEntitySet
基本上,当 Detail View Controller 正在检测 RouteMatch 时,我在 Master View 上接收到选定的行,并将其绑定到 View Detail。完成后,我将检查视图是否已生成,然后调用一种方法将 Expanded 实体绑定到 iconTabBar 元素,其中包含3个片段。代码如下:
function _onRoutePatternMatched(event) {
if (event.getParameter("name") === "detail") {
var path = event.getParameter("arguments").contextPath;
if (path !== " ") {
var path2 = "/" + path;
view.bindElement(path2);
if (view) {
this._setBindingToIconTab("Master2Detail");
}
} else {
view.unbindElement();
}
}
}
_setBindingToIconTab函数如下:
_setBindingToIconTab: function (sAssociation) {
view.byId("iconTabBar").bindElement(sAssociation);
}
iconTabBar 是我在详细信息视图中分配给 IconTabBar 元素的 ID。
问题是,当我执行它并加载第一个片段时,一切正常。在第二个和第三个中,我得到了错误(但显示了值......)。当它们在屏幕上被选中时,我正在加载片段。如果它们没有生成,我将它们实例化并存储在一个数组中。我得到的错误是:
Assertion failed: The EDM property "DateFrom" was not found in the "ZZODATA_TEST_SRV.Master" entity type. - sap.ui.comp.smartfield.ODataControlFactory
它抱怨来自 DetailEntitySet 的字段不在 MasterEntitySet 中。
你能帮我处理一下吗?
因为没有 XML、运行 示例等。我无法告诉您为什么会出现此错误,但是..
最佳做法是在详细视图中也将所选实体展开为详细信息等
MasterEntitySet->DetailEntitySet
由于绑定会传播到子项,因此无需再次绑定 iconTabBar。数据已经存在。同样,我不知道你的情况,但大多数服务看起来像这样
MasterEntitySet->DetailEntitySet->DataVariantA(ForIconTab1)
->DataVariantB(ForIconTab2)
->DataVariantC(ForIconTab3)
在 V4 中,您的详细代码如下所示
oView.bindObject({
path: "/MasterEntity(" + this._args.ID + ")",
parameters: {
$expand:`DetailEntityNavPath($expand=DataVariantANavPath()...`
},
events: {
dataReceived: (oEvent) => {...