有时,odata请求在我的SAPUI5中的特定应用程序中崩溃(在iwfnd / error_log中GW端没有错误)。 如果我在Chrome网络标签中重播该呼叫,它始终有效。
我收到此错误:发生以下问题:请求已中止 -
使用的SAPUI5版本是:“1.38.9”。 这是堆栈:
O @ sap-ui-core.js:formatted:9550
Q.fatal @ sap-ui-core.js:formatted:9571
h._handleError @ ODataModel.js:6
k @ ODataModel.js:6
(anonymous) @ ODataModel.js:6
i.abort @ datajs.js:17
abort @ ODataModel.js:6
c.abortPendingRequest @ ODataListBinding.js:6
c.filter @ ODataListBinding.js:6
当我点击“主”列表中的某个项目时出现“主要细节”情况时,我会在细节中过滤一些数据。问题是,由于Odata请求中止,数据实际上没有更新。 以下是代码的简短版本:
_onRouteMatched: function(oEvent) {
filterCharac.push(new sap.ui.model.Filter("Zrwk", sap.ui.model.FilterOperator.EQ, oArgs.idRework));
filterCharac.push(new sap.ui.model.Filter("Ztasknb", sap.ui.model.FilterOperator.EQ, oArgs.taskId));
this.getView().byId("TableCharac").getBinding("items").filter(filterCharac);
this.getView().byId("StatusLog").getBinding("items").filter(new sap.ui.model.Filter("Zrwk", sap.ui.model.FilterOperator.EQ, oArgs.idRework));
this.getView().byId("lowestItems").getBinding("items").filter(filterCharac);
var commentsFeed = this.getView().byId("Comments");
var oFilter = new sap.ui.model.Filter("Zrwk", sap.ui.model.FilterOperator.EQ, oArgs.idRework); // name between A and G
commentsFeed.getBinding("items").filter(oFilter);
}
答案 0 :(得分:1)
这主要发生在获取某些数据(例如完整列表内容)的请求被中止时,因为在请求完成之前对列表应用了过滤(或排序)。因为UI5检测到最初请求的数据将不再有用,并且#34;它会中止请求。
UI5代码中的以下注释解释了这一点(code is on github):
/*
* Aborts the current pending request (if any).
*
* This can be called if we are sure that the data from the
* current request is no longer relevant, e.g. when filtering /
* sorting is triggered or the context is changed.
*/
理论上,这不应该影响你的应用程序的行为(但我想在控制台中看到错误是很难看的)。您可以通过在聚合上应用先前的过滤来避免这种情况(例如,直接在视图中而不是在控制器内部)。
如果您可以向我们展示您正在过滤的聚合(可能来自JS)以及如何在视图中定义它,那么我们可以提出更具体的解决方案。