+ Start a Discussion
John NeffJohn Neff 

Having trouble conditionally rendering table columns in VF page- can anyone help?


I have a VF page that is using apex:repeat to create a table column for each related object record like so:
<apex:repeat value="{!Quarterly_Buy__c.Media_Buys__r}" var="buys">
                     <td style="background-color: #D8D8D8; color: #190707;font-size:14px;" align="center">

I want to add a condition where a column is only renedered if the field "Broadcast_Week__c" on the child record is greater than Today. 

I have adding a "Display" attribute to the td saying: 
display: {!IF(Quarterly_Buy__c.Media_Buys__r.Broadcast_Week__c < Today(), 'none', 'table-column')};"

but I am getting en error. 

Can anyone help? 


Either use <apex:column> instead of <td> OR put <td> inside <apex:outputPanel rendered="{!}">
John NeffJohn Neff
Thanks, for some reason if I put the <td> inside <apex:outputPanel> the values show up on their each row instead of continuing on the same row as column headers. 

Hmm weird. Can you try using <apex:column>? You may have to use <apex:pageBlockTable> instead
John NeffJohn Neff
I got it! It worked with outputText instead of outputPanel!