[英]How can provide link to a record from visualforce page using outputlink
Could anyone help me out on providing link in this scenario 在这种情况下,谁能帮助我提供链接
<apex:repeat var="slot" value="{!liTimeSlots}">
<tr class="{!IF(ISNULL(slot.sAppointment), 'Free', 'Fill')}">
<td ><apex:outputText value="{!slot.tstart1}"/></td>
<td><apex:outputText value="{!IF(ISNULL(slot.sAppointment), 'Free', slot.sAppointment.name)}"/></td>
<td><apex:outputText value="{!IF(ISNULL(slot.sAppointment), '', slot.sAppointment.Appointment_Type__c)}"/></td>
<td><apex:outputText value="{!IF(ISNULL(slot.sAppointment), '', slot.sAppointment.Patient__c)}"/></td>
</tr>
<tr >
<td></td>
<td><apex:outputText value="{!IF(ISNULL(slot.sAppointmentOverlap), ' ', slot.sAppointmentOverlap.name)}"/></td>
<td><apex:outputText value="{!IF(ISNULL(slot.sAppointmentOverlap), '', slot.sAppointmentOverlap.Appointment_Type__c)}"/></td>
<td><apex:outputText value="{!IF(ISNULL(slot.sAppointmentOverlap), '', slot.sAppointmentOverlap.Patient__c)}"/></td>
</tr>
</apex:repeat>
I want to show the link only if slot.sAppointment or slot.sAppointmentOverlap is not null. 我只想在slot.sAppointment或slot.sAppointmentOverlap不为null时显示链接。
Any idea how to approach this. 任何想法如何解决这个问题。
Thanks 谢谢
Prady Prady
Like pretty much all of the apex:
Visualforce tags, apex:outputLink
has a rendered
attribute which can be used to show or hide it, and this can use a merge field / formula for the value, so you'll be looking for something along the lines of: 就像几乎所有的
apex:
Visualforce标记一样, apex:outputLink
具有一个rendered
属性,可用于显示或隐藏它,并且该属性可以使用合并字段/公式作为值,因此您将一直在寻找一些东西的行:
<apex:outputLink value="url" rendered="{!NOT(ISNULL(slot.sAppointment)) || NOT(ISNULL(slow.AppointmentOverlap))}">The link</a>
Another trick I use for conditional rendering for a group of markup elements is to wrap them in an apex:variable
tag: 我用于一组标记元素的条件渲染的另一个技巧是将它们包装在
apex:variable
标签中:
<apex:variable var="v" value="" rendered="{!ShouldThisRender}">
<!-- Some page elements -->
</apex:outputVariable>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.