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
Shaan Khokhar 9Shaan Khokhar 9 

Rendered is making my column headers disappear

Hi everyone,

So i am trying to make my empty columns disappear, and i've achieved this however, the rendered part of my code is also making my headers disappear. How would i solve this?

My code:
<apex:pageBlock >
            <apex:pageBlockTable value="{!qli}" var ="opp">
                <apex:column  headerValue = "Device Name" value = "{!opp.Device_Name__c}" rendered="{!NOT(ISNULL(opp.Device_Name__c))}"/>
                <apex:column headerValue = "Device Type" value="{!opp.Device_Type__c}" rendered="{!NOT(ISNULL(opp.Device_Type__c))}" />
                <apex:column headerValue = "Part Number" value="{!opp.Product2.Name}" rendered="{!NOT(ISNULL(opp.Product2.Name))}" />
                <apex:column headerValue="Serial Number" value="{!opp.Serial_Number__c}" rendered="{!NOT(ISNULL(opp.Serial_Number__c))}" />
                <apex:column headerValue="Contract Start Date" value="{!opp.Contract_Start_Date__c}" rendered="{!NOT(ISNULL(opp.Contract_Start_Date__c))}"/>
                <apex:column  headerValue="Contract End Date" value="{!opp.Contract_End_Date__c}" rendered="{!NOT(ISNULL(opp.Contract_End_Date__c))}"/>
            </apex:pageBlockTable>             
      </apex:pageBlock>

 
Best Answer chosen by Shaan Khokhar 9
AbhishekAbhishek (Salesforce Developers) 
Can you try the suggestions as mentioned in the below blogs,

https://salesforce.stackexchange.com/questions/219336/getting-apexcolumn-headers-to-work-while-using-rendered-tag?rq=1

https://developer.salesforce.com/forums/?id=906F0000000DBolIAG

Thanks.,

All Answers

AbhishekAbhishek (Salesforce Developers) 
Can you try the suggestions as mentioned in the below blogs,

https://salesforce.stackexchange.com/questions/219336/getting-apexcolumn-headers-to-work-while-using-rendered-tag?rq=1

https://developer.salesforce.com/forums/?id=906F0000000DBolIAG

Thanks.,
This was selected as the best answer
Shaan Khokhar 9Shaan Khokhar 9
See those keep the headers in if the column is empty. I want it so that it doesn't keep the empty column headers in 
Shaan Khokhar 9Shaan Khokhar 9
I decided against using pageblock table and instead utilze html tables