我正在使用sap.m.ObjectListItem
作为我已从 API 绑定 JSON 数据的列表项。但是,当我按下某个项目时,我找不到从列表中获取所选项目的方法。甚至获得该物品的钥匙也会有帮助。
<List id="ObjectList"
itemPress=".onPressDcData"
items="{DC>/}"
>
<ObjectListItem
type="Active"
title="{DC>Name}"
/>
</List>
以下内容应放置在您各自的控制器中(但我猜您已经实现了类似的东西)
onPressDcData: function(oEvent) {
// The actual Item
var oItem = oEvent.getSource();
// The model that is bound to the item
var oContext = oItem.getBindingContext("DC");
// A single property from the bound model
var sName = oContext.getProperty("Name");
}
希望有帮助
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)