[英]ODATA request aborted
有時,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);
}
這主要發生在獲取某些數據(例如完整列表內容)的請求被中止時,因為在請求完成之前對列表應用了過濾(或排序)。 因為 UI5 檢測到最初請求的數據將不再“有用”,所以它會中止請求。
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.
*/
從理論上講,這不應該影響您的應用程序的行為(但我想在控制台中看到錯誤很難看)。 您可以通過更早地在聚合上應用過濾來避免這種情況(例如,直接在視圖中而不是在控制器內部)。
如果您可以向我們展示您正在過濾的聚合(可能來自 JS)以及您如何在視圖中定義它,也許我們可以提出更具體的解決方案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.