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
j-dj-d 

apex:dataTable multiple rows per record - too many headers

The following code in Visual Force seems to be repeating the headers for every row in my data table, effectively creating 7+6+6 = 19 header columns. It properly displays 1 header for column 1 presumably because of the rowspan="3", but not for the others. How would I prevent the headers from repeating for the second and third rows of columns 2 through 7?

<apex:page standardController="Account">
<apex:form >
<apex:pageBlock title="Vendor Budget">
<apex:pageBlockButtons location="top"><apex:commandButton value="Refresh"></apex:commandButton></apex:pageBlockButtons>
    <apex:pageBlockTable value="{!account.Budget__r}" var="budget" cellpadding="0" cellspacing="0" width="100%" columns="7">
        <apex:column rowspan="3">
            <apex:facet name="header">Sales Rep</apex:facet>
            <a href="/{!budget.Id}">{!budget.Owner.Name}</a>
        </apex:column>
        <apex:column >
            <apex:facet name="header">&nbsp;</apex:facet>
            Budget
        </apex:column>
        <apex:column >
            <apex:facet name="header">Q1</apex:facet>
            {!budget.Projected_Q1_Volume__c}
        </apex:column>
        <apex:column >
            <apex:facet name="header">Q2</apex:facet>
            {!budget.Projected_Q2_Volume__c}
        </apex:column>   
        <apex:column >
            <apex:facet name="header">Q3</apex:facet>
            {!budget.Projected_Q3_Volume__c}
        </apex:column>   
        <apex:column >
            <apex:facet name="header">Q4</apex:facet>
            {!budget.Projected_Q4_Volume__c}
        </apex:column>
        <apex:column >
            <apex:facet name="header">Total</apex:facet>
            {!budget.Projected_Annual_Volume__c}
        </apex:column>
        <apex:column breakBefore="True">
            Actual
        </apex:column>
        <apex:column >
            {!budget.Actual_Q1_Volume__c}
        </apex:column>
        <apex:column >
            {!budget.Actual_Q2_Volume__c}
        </apex:column>   
        <apex:column >
            {!budget.Actual_Q3_Volume__c}
        </apex:column>   
        <apex:column >
            {!budget.Actual_Q4_Volume__c}
        </apex:column>
        <apex:column >
            {!budget.Actual_Annual_Volume__c}
        </apex:column>
        <apex:column breakBefore="True" style="font-weight:bold;">
            Variance
        </apex:column>
        <apex:column style="font-weight:bold;">
            {!budget.Q1_Volume_Variance__c}
        </apex:column>
        <apex:column style="font-weight:bold;">
            {!budget.Q2_Volume_Variance__c}
        </apex:column>   
        <apex:column style="font-weight:bold;">
            {!budget.Q3_Volume_Variance__c}
        </apex:column>   
        <apex:column style="font-weight:bold;">
            {!budget.Q4_Volume_Variance__c}
        </apex:column>
        <apex:column style="font-weight:bold;">
            {!budget.Annual_Variance__c}
        </apex:column>     
    </apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>


Message Edited by j-d on 10-31-2008 12:54 PM
MVJMVJ

You may want to try the HeaderValue tag as part of the apex:column.

Here ia an example that works well for me:

Code:
<apex:dataTable value="{!ServiceCases}" var="each" cellpadding="10" border="0" styleClass="list">
        <apex:column headerValue="Case"><a href="/{!each.Id}">{!each.CaseNumber}</a></apex:column>  
        <apex:column headerValue="Contact Name">{!each.Contact.Name}</apex:column>  
        <apex:column headerValue="Subject">{!each.subject}</apex:column>  
        <apex:column headerValue="Priority">{!each.Priority}</apex:column>
        <apex:column headerValue="Status">{!each.Status}</apex:column>
        <apex:column headerValue="Case Owner">{!each.Owner.name}</apex:column>
    </apex:dataTable>


 

j-dj-d
Found the problem. I was using the apex pageblocktable tag instead of datatable. After using datatable, the formatting was correct. Thanks for the input.