如何使用 Outputlink 从 Visualforce 页面提供指向记录的链接

发布于 2024-12-10 15:06:30 字数 1288 浏览 2 评论 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 不为空时显示链接。

知道如何解决这个问题。

谢谢普拉迪

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.

Any idea how to approach this.

Thanks

Prady

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

春夜浅 2024-12-17 15:06:30

与几乎所有 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>

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: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 var="v" value="" rendered="{!ShouldThisRender}">
   <!-- Some page elements -->
</apex:outputVariable>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文