2017-02-24 59 views
0

有時,odata請求在SAPUI5中的特定應用程序中崩潰(iwfnd/error_log中的GW側沒有錯誤)。 如果我在Chrome網絡選項卡中重放呼叫,它總是有效。ODATA請求中止

我得到這個錯誤:下面的問題出現了:請求停止 -

使用的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

你可以分享調用過濾器方法的函數嗎?過濾器是否在XMLview中硬編碼?調用過濾器方法後,你做了什麼?一般來說,更多的代碼會有幫助。 – boghyon

回答

1

這主要發生在用於獲得一些數據(例如完整的列表內容)的請求,因爲一個濾波(或排序)在之前施加到該列表被中止請求已完成。由於UI5檢測到最初請求的數據將不再「有用」,它會中止請求。

從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)以及如何在視圖中定義它,也許我們可以提出更具體的解決方案。