0

谁能帮我在这种情况下提供链接

<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>

只有当 slot.sAppointment 或 slot.sAppointmentOverlap 不为空时,我才想显示链接。

任何想法如何解决这个问题。

谢谢

普拉迪

4

1 回答 1

4

与几乎所有apex:Visualforce 标签一样,apex:outputLink具有rendered可用于显示或隐藏它的属性,这可以使用合并字段/公式作为值,因此您将寻找以下内容:

<apex:outputLink value="url" rendered="{!NOT(ISNULL(slot.sAppointment)) || NOT(ISNULL(slow.AppointmentOverlap))}">The link</a>

我对一组标记元素进行条件渲染的另一个技巧是将它们包装在apex:variable标签中:

<apex:variable var="v" value="" rendered="{!ShouldThisRender}">
   <!-- Some page elements -->
</apex:outputVariable>
于 2011-10-20T01:27:46.847 回答