我正在使用以下代码动态创建列表视图:
<amx:listView var="row" value="#{bindings.allMeetingsAsOrganizer.collectionModel}"
fetchSize="#{bindings.allMeetingsAsOrganizer.rangeSize}"
selectedRowKeys="#{bindings.allMeetingsAsOrganizer.collectionModel.selectedRow}"
selectionListener="#{bindings.allMeetingsAsOrganizer.collectionModel.makeCurrent}"
showMoreStrategy="autoScroll" bufferStrategy="viewport" id="panel1">
<amx:listItem id="li1" showLinkIcon="false" actionListener="#{viewScope.browseMeetingsBean.onMeetingSelect}" action="toDisplayMeeting">
<amx:tableLayout width="100%" id="tl3" cellSpacing="5">
<amx:rowLayout id="rl1">
<amx:cellFormat width="40px" halign="center" id="cf2">
<amx:image source="images/outlook.png" id="i3" inlineStyle="height:38px;"/>
</amx:cellFormat>
<amx:cellFormat width="100%" height="43px" id="cf5">
<amx:outputText value="#{row.subject}" id="ot2" inlineStyle="font-size:large;margin:5px;"/>
<amx:outputText value="#{row.meeting_location}" id="ot3"
inlineStyle="font-size:medium; margin:5px;"/>
<amx:outputText value="#{row.start_date_time}" id="ot7"
inlineStyle="color:Teal; font-size:small;margin:5px;"/>
<amx:outputText value="Attendees : #{row.attendees_count_internal}/#{row.attendees_count_external}" id="ot4"
inlineStyle="color:Teal; font-size:small;margin:5px;"/>
</amx:cellFormat>
<amx:cellFormat width="40px" halign="center" id="cf1">
<amx:image source="images/confirm.png" id="i1" inlineStyle="height:28px;"/>
</amx:cellFormat>
</amx:rowLayout>
</amx:tableLayout>
</amx:listItem>
</amx:listView>
正如您所看到列表项上已有一个动作侦听器,那么如何通过单击列表项中的图像来执行任何操作?
是:
<amx:cellFormat width="40px" halign="center" id="cf1">
<amx:image source="images/confirm.png" id="i1" inlineStyle="height:28px;"/>
答案 0 :(得分:1)
使用 amx:commandLin k标记围绕 amx:image 标记,在amx:commandLink标记上,您可以为图像定义actionListener。