function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
John NeffJohn Neff 

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

Hello, 

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">
                        <b>{!MONTH(buys.Broadcast_Week__c)}/{!DAY(buys.Broadcast_Week__c)}/{!VALUE(RIGHT(TEXT(YEAR(buys.Broadcast_Week__c)),2))}</b>
                    </td>

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? 

Thanks, 

John
SalesFORCE_enFORCErSalesFORCE_enFORCEr
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. 

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

Thanks!