You need to sign in to do that
Don't have an account?
Tony Mann 9
Have Table only Render in VF Template when Object is Populated
Hello,
I have code that populates a table from a custom object in my VF email template. I want to have it so the table only shows when their is data in the custom object. Including the header. Code below.
Is it possible?
Thanks!
<br><b>Related Family</b></br>
<br></br>
<table border="0" >
<tr >
<th>Name</th>
<th>Relationship</th>
<th>Date of Birth</th>
<th>Notes</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.Related_Guests__r}">
<tr>
<td>{!cx.Name}</td>
<td>{!cx.Type__c}</td>
<td>{!cx.Date_of_Birth__c}</td>
<td>{!cx.Notes__c}</td>
</tr>
</apex:repeat>
</table>
I have code that populates a table from a custom object in my VF email template. I want to have it so the table only shows when their is data in the custom object. Including the header. Code below.
Is it possible?
Thanks!
<br><b>Related Family</b></br>
<br></br>
<table border="0" >
<tr >
<th>Name</th>
<th>Relationship</th>
<th>Date of Birth</th>
<th>Notes</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.Related_Guests__r}">
<tr>
<td>{!cx.Name}</td>
<td>{!cx.Type__c}</td>
<td>{!cx.Date_of_Birth__c}</td>
<td>{!cx.Notes__c}</td>
</tr>
</apex:repeat>
</table>
Use <apex:outputPanel rendered="{!dataList}"/>
Inside this write your table
<apex:outputPanel>
dataList will be the list of the records that you will be returning from the controller. So if the list will be empty then the table will not be rendered.