Salesforce | Dynamic table column headings in a VisualForce page

|
| By Webner

In VisualForce Page I wanted to have different column headings, like this:
1
I tried it using tag and tag but you can not display header value using tag as well as <apex:facetname=”header” > tag.

<apex:repeat value="{!prolist}" var="ls" >

<apex:column headerValue="Producer Commission"> 

<apex:outputText  value="{!ls}"/>

     </apex:column>
   </apex:repeat>

or<apex:repeat value="{!prolist}" var="ls" >

 
<apex:column> 

  <apex:facetname="header">Producer Commission</apex:facet>  

    <apex:outputText value="{!ls}"/>

   </apex:column>
  </apex:repeat>

Solution: You need to use html <table> tag to create table in this case.

<table border="1" id="t01" >
<thead>

<tr>

<apex:repeat value="{!prolist}" var="ls" >

<th>

Producer

</th>

</apex:repeat>

</tr>

</thead>
<tr>
<apex:repeat value="{!prolist}" var="ls" >

<td>
<apex:outputText value="{!ls}"/>
</td>
</apex:repeat>
</tr>
</table>


Leave a Reply

Your email address will not be published. Required fields are marked *