簡體   English   中英

為什么我在 dataReceived 事件上得到 oEvent.getParameter('data') undefined?

[英]Why am I getting oEvent.getParameter('data') undefined on dataReceived event?

this.getView().bindElement({
  path: `/Employees('${this._userId}')`,
  parameters: { expand: 'aaa,bbb,ccc' },
  events: {
    dataReceived: (oEvent) => {
      this.getView().setBusy(false)
      debugger
    }
  }
});

我可以在$batch請求的響應中看到數據。 當我在dataReceived function 處理程序中放置斷點時,我還可以通過this.getView().getModel().getProperty(this.getView().getBindingContext().getPath())查看數據。 參數oEvent.mParameters.data存在,但值為undefined

如果我遺漏了expand ,則data已設置。 關聯實體集的所有實體都需要與其父實體關聯嗎?

這是根據 dataReceived 的dataReceived參考設計的:

數據接收

[...]發生錯誤時也可能觸發此事件。

參數 類型 描述
數據 細繩 收到的數據; 在錯誤情況下undefined

您必須在 $batch 響應中的某處有錯誤消息,或者請求以某種方式中止。

缺少的data參數是目前唯一記錄在案的bindObject / bindElement請求失敗的指標。


PS:另見https://github.com/SAP/openui5/issues/2263

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM