+ Start a Discussion

Help with column header in Visualforce

Please let me know if more info is needed, but this is what we had originally:
headerValue="Description" value="{!OP.PriceBookEntry.Name}" headerClass="column_ttl" 
rendered="{!Opportunity.Language__c = 'ENGLISH'}">

I then changed it by adding another filter to "rendered"...
headerValue="Description" value="{!OP.PriceBookEntry.Name}" headerClass="column_ttl" rendered="{!Opportunity.Language__c = 'ENGLISH' && OP.Lease_Service_Group__c = 'NQP'}">

It is working in that it is showing me only the Opportunity Products (OP) that have a Lease Service Group of "NQP", and it is showing the English names, but for some reason my headerValue "Description" no longer appears on the page.  The column no longer has a header.

Is there something I don't understand or did wrong to cause this?

Any help would be appreciated! 
Jean Grey 10Jean Grey 10
You could try moving the {!OP.PriceBookEntry.Name} to outputText within the column tag, then using the conditional rendering on the output text instead of the column.
something like <apex:column headerValue="Description" headerClass="column_ttl"><apex:outputText value="{!OP.PriceBookEntry.Name}" rendered="{!Opportunity.Language__c = 'ENGLISH'}" /></apex:column>
Hmmm that didn't seem to do it.  Here's the full picture.  I have this pageBlockTable (below) and I need it to only show the {!Opportunity.opportunityLineItems} (var = OP) where the field "OP.Lease_Service_Group__c" = 'NQP'

The following seems to have filtered successfully, but my headers are lost...any ideas?
                        <apex:pageblockTable value="{!Opportunity.opportunityLineItems}" var="OP" styleClass="items_tbl">
                            <apex:column rendered="{!OP.Lease_Service_Group__c = 'NQP'}" headerValue="{!lblQty}" headerClass="column_ttl tac" styleClass="tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OP.Quantity}" /></apex:outputText></apex:column>
                            <apex:column headerValue="Description" value="{!OP.PriceBookEntry.Name}" headerClass="column_ttl" rendered="{!OP.Lease_Service_Group__c = 'NQP' && Opportunity.Language__c = 'ENGLISH'}"></apex:column>
                            <apex:column headerValue="Description" value="{!OP.Product2.Product_name_french__c}" headerClass="column_ttl" rendered="{!OP.Lease_Service_Group__c = 'NQP' && Opportunity.Language__c = 'FRENCH'}"></apex:column>
                            <apex:column rendered="{!OP.Lease_Service_Group__c = 'NQP'}" headerValue="{!lblSubTot}" value="{!OP.TotalPrice}" headerClass="column_ttl tac" styleClass="tar" style="width:15%;"></apex:column>

Jean Grey 10Jean Grey 10
Try using an IF statement like in this example: https://help.salesforce.com/articleView?id=000003854&type=1