【发布时间】:2014-04-29 21:20:42
【问题描述】:
我有 xml 视图(缩写):
<mvc:View controllerName="view.xxx" xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns:control="control" xmlns:app="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" xmlns:h="http://www.w3.org/1999/xhtml">
...
<HBox items="{/ResourceSet}">
<Select id="myResource" app:ResourceKey="{ResourceKey}" change="handleChange"
(/ResourceSet 不产生一个条目或一个条目,仅此而已,因此 id 将始终是唯一的)
在控制器的handleChange(evt)函数内部:
evt.getSource().data()
正确生成对象 {ResourceKey: "xxxxxxx"}
this.getView().byId("myResource").data()
产生错误的对象 {ResourceKey: null}
这不好!
至少在 1.18.x 和 1.20.4 中发生。
任何想法如何访问不是当前事件源的元素的数据?
问候, 沃尔夫冈
PS http://sap.github.io/openui5/bugreports.html 要求提供 jsbin/gist:示例中是否有首选的公共 OData 源(我会更喜欢基于 NWG 的源而不是基于 MS 的源,如 http://services.odata.org/Northwind/Northwind.svc)?
【问题讨论】:
-
当你调用 this.getView().byId("myResource").data() 时? “这个”是控制器吗? alt 尝试 sap.ui.getCore().byId("myResource").data()
标签: sapui5