+ Start a Discussion

Sub-Header in DataTable

Hey Guys, I'm having trouble creating a table with a sub header. I'd like to use standard visualforce components but I'm not sure its possible. Here's a sample image. Currently, I'm using a dataTable with a column header of "Main Header". I having trouble creating the "Sub Headers". I've tried to nest dataTables but I dont want to subHeader to repeat. Any and All feedback is welcome. Thanks
Example Table and Header
Best Answer chosen by KRay
Prabhat Kumar12Prabhat Kumar12
Hi KRay i don't find any standard functionality to do this, there is workaround and you can achieve this by defining table in your header of the data table. Please look into following code and let me know if does not work.
<apex:page controller="dataTableCon" id="thePage">

    <apex:dataTable value="{!accounts}" var="account" id="theTable" rowClasses="odd,even"

        <apex:facet name="header">
       <table style="text-align:center;" border="1" width="100%">
            <td  colspan="3">Main Header</td>
            <td>Sub Headdr #1</td>
            <td>Sub Headdr #2</td>
            <td>Sub Headdr #3</td>

        <apex:column >


            <apex:outputText value="{!account.name}"/>


        <apex:column >

            <apex:outputText value="{!account.owner.name}"/>

        <apex:column >

            <apex:outputText value="{!account.billingCity}"/>