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
knicholsknichols 

dataTable conditionally display column header

Can you only show a column header if the rows have data in them?  In the code below we don't want to display FOB if they can't view that column.

 

<apex:pageBlockTable value="{!priceListCanada}" var="p"> <apex:column > <apex:facet name="header"> <apex:outputText value="FOB" /> </apex:facet> <apex:outputText value="{!p.FOB__c}"/> </apex:column>

 

ColinKenworthy1ColinKenworthy1

Try

 

    <apex:outputText value="FOB" rendered="{!p.FOB__c=''}" />

 

knicholsknichols
Nope, that's not it.
ColinKenworthy1ColinKenworthy1

You can do it in a controller extension in your visualforce page

<apex:page standardController="YourObject__c" extensions="myPageController" recordSetVar="priceListCanada">

and a property

 

<apex:outputText value="FOB" rendered="{!FOBDisplay}" />

Then an apex class

 

public class myPageController {

private YourObject__c p ;
public Boolean FOBDisplay { get; set; }

    public myPageController(ApexPages.StandardSetController controller) {
        p = (YourObject__c) controller.getRecord() ;
             
        if (p.FOB__c == null)
          {FOBDisplay = false;}
         else
          {FOBDisplay = true;}
    }
}

Fill in your own values for "YourObject__c" and "myPageController"

 

knicholsknichols
Colin, thanks for taking the time to reply again but I don't think that will work either.  The problem is I'm doing this for our product search and the fields we are having problems with are on a custom related list for pricing.  It worked when we used the standard <apex:detail> but the business wanted to pricing related lists to be before the standard detail.