以"title"作为超链接的 SAP UI5 对象列表项



请建议带有超链接的对象列表项"标题",然后单击它时,应导航到新选项卡中的某个URL。

<List items="{ path: 'sonarReport>/measures' }"
id="sonarRepId"
mode="SingleSelectMaster" 
selectionChange="onChange"
updateFinished="onFinsihed">            
<ObjectListItem icon="{sonarReport>imageL}"
**title="{sonarReport>value}"**
class="sonarCustom"
type="Active">
<attributes>
<ObjectAttribute text="{sonarReport>metric}"></ObjectAttribute>
</attributes>
<firstStatus>
<ObjectStatus title="{sonarReport>state}"
icon="{sonarReport>image}"
state="Success"></ObjectStatus>
</firstStatus>
</ObjectListItem>               
</List>

你可以选择像这样扩展ObjectListItem

ObjectListItem.extend("ObjectListItemEx", {
metadata: {
events: {
titlePress: {}
}
},
renderer: {},
onAfterRendering: function() {
if (ObjectListItem.prototype.onAfterRendering) {
ObjectListItem.prototype.onAfterRendering.apply(this, arguments);
}
var that = this;
this.$().find(".sapMObjLTitle").each(function() {
var $this = $(this);
$this.click(function() {
that.fireTitlePress();
});
$this.css("cursor", "pointer");
});
}
});

演示:https://jsbin.com/hofumej/1/edit?js,output

我已将其替换为自定义列表项,并且可以非常灵活地放置不同的项。

最新更新