+ Start a Discussion

Display a table of static values with VisualForce styling

What component should I use to produce something that looks like a VisualForce data table but populated with static values.


I'd just use a table but that would not blend in with the rest of the page that has the VisualForce look to it.



Best Answer chosen by Admin (Salesforce Developers) 

PageBlockTable is the VF styled table:


<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock >
        <apex:pageBlockTable value="{!accounts}" var="a">
            <apex:column value="{!a.name}"/>     


If you want to just use static values in a table with no controller, you could do this:

(NOTE: There is a risk that Salesforce could change their Style Sheet and you would lose your styling)


<apex:page controller="MyController">
    <apex:pageBlock >
        <table class="list">
            <thead class="rich-table-thead">
                <tr class="headerRow">
                    <th class="headerRow" scope="col" colspan="1">
                    <div>Account Name</div>
            <tr class="dataRow odd"><td class="dataCell" colspan="1"><span>Burlington Textiles Corp of America</span></td></tr>