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
jucuzoglujucuzoglu 

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) 
TheSwamiTheSwami

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}"/>     
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

 

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>
                    </th>
                </tr>
            </thead>
            <tr class="dataRow odd"><td class="dataCell" colspan="1"><span>Burlington Textiles Corp of America</span></td></tr>
        </table>    
    </apex:pageBlock>
</apex:page>