I am trying to set up a VF page so that some of the columns only show when they have data. My VF page uses a custom list controller. I have tried using a rendered attribute in the column tag, and while that works when there is no data, if one of my rows has data the column header attribute remains blank. Does anyone know how I can accomplish this?
VF Page:
<apex:page Controller="CalculateQLISummary" action="{!init}" tabStyle="Quote__c">
<apex:pageMessages id="pgMess" />
<apex:form>
<apex:pageBlock title="Summary">
<center><apex:commandButton title="Back" value="Back" action="{!cancel}"/></center><br/><br/>
<apex:outputText value="Summary" /><p/>
<apex:pageBlockTable title="Grouping Summary" value="{!listQLI2}" var="OLI2" style="width:100%">
<facet name="Grouping"/>
<apex:column headerValue="Product" style="width:30%">
<apex:outputField value="{!OLI2.Name}"/>
</apex:column>
<apex:column headerValue="List Price" rendered="{!IF(OLI2.List_Price__c != NULL,true,false)}">
<apex:outputField value="{!OLI2.List_Price__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>