You need to sign in to do that
Don't have an account?
Jaymin Sutarwala 7
Render hyperlink conditionally in dataTable
Hi all,
I am trying to render hyperlink in the one of the columns of datatable in visualforce component. My requirement is to render the first four row values (Primary, Secondary, Tertiary, Non-Target) as hyperlink but the last row (Total) should not be displayed as hyperlink.
I tried using 'rendered' attribute in the <apex:outputLink> tag but on doing that it is not displaying any values in the column (shown below). Can anyone recommend a way to achieve this?
Regards,
Jaymin
I am trying to render hyperlink in the one of the columns of datatable in visualforce component. My requirement is to render the first four row values (Primary, Secondary, Tertiary, Non-Target) as hyperlink but the last row (Total) should not be displayed as hyperlink.
I tried using 'rendered' attribute in the <apex:outputLink> tag but on doing that it is not displaying any values in the column (shown below). Can anyone recommend a way to achieve this?
<apex:dataTable value="{!DPSRandFValues}" var="DPSRandFData" cellpadding="5" border="1" headerClass="RFheaderStyle" styleClass="inlineTable"> <apex:column headerValue=" " style="{!DPSRandFData.color}"> <apex:outputLink rendered="NOT({!DPSRandFData.targetClassification} = 'Total')" value="javascript:window.open('https://cs40.salesforce.com/00O54000000Fuor?pv0={!TPOwnerFullName}&pv1={!TPOwnerFullName}&pv2={!FYStartDt}&pv3={!FYEndDt}&pv4={!DPSRandFData.targetClassification}')" > {!DPSRandFData.targetClassification} </apex:outputLink> </apex:column> <apex:column headerValue="{!$Label.TP_R_F_header_Clients}" value="{!DPSRandFData.totalClients}" style="{!DPSRandFData.color}"/> <apex:column headerValue="{!$Label.TP_R_F_header_Reached}" value="{!DPSRandFData.clientsReached}" style="{!DPSRandFData.color}"/> <apex:column headerValue="{!$Label.TP_R_F_header_Activities}" value="{!DPSRandFData.totalActivities}" style="{!DPSRandFData.color}"/> <apex:column headerValue="{!$Label.TP_R_F_header_Frequency}" value="{!DPSRandFData.clientsFrequency}" style="{!DPSRandFData.color}"/> </apex:dataTable>
Regards,
Jaymin
I checked your code in my org to reproduce the issue you are facing and found that the way you are rendering the table has the issue.
Please try either of the below codes for the outputLink and let me know if you still face issues:
<apex:outputLink rendered="{!IF(DPSRandFData.targetClassification == 'Total',false,true)}" value="javascript:window.open('https://cs40.salesforce.com/00O54000000Fuor?pv0={!TPOwnerFullName}&pv1={!TPOwnerFullName}&pv2={!FYStartDt}&pv3={!FYEndDt}&pv4={!DPSRandFData.targetClassification}')" > {!DPSRandFData.targetClassification}
</apex:outputLink>
OR
<apex:outputLink rendered="{!NOT(DPSRandFData.targetClassification == 'Total')}" value="javascript:window.open('https://cs40.salesforce.com/00O54000000Fuor?pv0={!TPOwnerFullName}&pv1={!TPOwnerFullName}&pv2={!FYStartDt}&pv3={!FYEndDt}&pv4={!DPSRandFData.targetClassification}')" > {!DPSRandFData.targetClassification}
</apex:outputLink>
In order to display Total, you need to show the outputtext column and rendered condition should be
{!IF(DPSRandFData.targetClassification == 'Total',true,false)}