简体   繁体   English

ODATA 请求中止

[英]ODATA request aborted

Sometimes, the odata request crashed in my specific app in SAPUI5 (no error on the GW side in iwfnd/error_log).有时,odata 请求在我在 SAPUI5 中的特定应用程序中崩溃(iwfnd/error_log 中的 GW 端没有错误)。 If I replay the call in chrome network tab it always works.如果我在 chrome 网络选项卡中重播呼叫,它总是有效。

I get this error :The following problem occurred: Request aborted -我收到此错误:发生以下问题:请求中止 -

The SAPUI5 version used is : "1.38.9".使用的 SAPUI5 版本是:“1.38.9”。 Here is the stack :这是堆栈:

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

It is in the case of a "master detail" scenario when I click on an item in the "master" list I filter some data in the detail.在“主详细信息”方案的情况下,当我单击“主”列表中的项目时,我会在详细信息中过滤一些数据。 The problem is that the data is actually not updated as the Odata request abort.问题是数据实际上并未随着 Odata 请求中止而更新。 Here is the short version of the code :这是代码的简短版本:

    _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);

}

This mostly happens when a request for obtaining some data (eg the complete list contents) is aborted because a filtering (or sorting) is applied to the list before the request has completed.这主要发生在获取某些数据(例如完整列表内容)的请求被中止时,因为在请求完成之前对列表应用了过滤(或排序)。 Because UI5 detects that the data initially requested will no longer be "useful", it aborts the request.因为 UI5 检测到最初请求的数据将不再“有用”,所以它会中止请求。

The following comment from the UI5 code explains this ( code is on github ): UI5 代码中的以下注释对此进行了解释( 代码在 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.
 */

Theoretically, this should not affect the behavior of your application (but I guess it is ugly to see the errors in the console).从理论上讲,这不应该影响您的应用程序的行为(但我想在控制台中看到错误很难看)。 You can avoid this by applying the filtering earlier on the aggregation (eg directly in the view instead of inside the controller).您可以通过更早地在聚合上应用过滤来避免这种情况(例如,直接在视图中而不是在控制器内部)。

If you can show us what aggregation you are filtering (probably from JS) and how you define it in the view, maybe we can come up with a more specific solution.如果您可以向我们展示您正在过滤的聚合(可能来自 JS)以及您如何在视图中定义它,也许我们可以提出更具体的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM