繁体   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