+ Start a Discussion
Daniel RobertsDaniel Roberts 

Syntax for Cellpadding attribute on pageBlockTable?

<apex:page standardController="Contact" recordSetVar="contacts"  lightningStylesheets="true">
    <apex:pageBlock title="Contacts List">

        <!-- Contacts List -->
        <apex:pageBlockTable cellpadding="1000px" value="{! contacts }" var="ct">
            <apex:column value="{! ct.FirstName }"/>
            <apex:column value="{! ct.LastName }"/>
            <apex:column value="{! ct.Email }"/>
            <apex:column value="{! ct.Account.Name }"/>
        </apex:pageBlockTable>
        
    </apex:pageBlock>
</apex:page>

Hey everyone, trying to get a handle on VF pages, but having some trouble with the attribute cellpadding. My understanding is that it takes either px or % values, and should effect the internal padding of the cells, i.e. the cells should get bigger the larger the number. 

Here is my code. Can anyone help me understand why there is no change in the cell's size? 

 
ajay Duggi(Heptarc)ajay Duggi(Heptarc)
Dear Daniel,
 
<apex:dataTable value="{!account.Contacts}" var="contact"
                cellPadding="4" border="1">
  <apex:column>{!contact.FirstName}</apex:column>
  <apex:column><b>{!contact.LastName}</b></apex:column>
</apex:dataTable>
I hope you will get cellpadding syntax from my code.
<apex:pageBlockTable value="{!Contacts}" width="100%" var="c" cellpadding="2">
And here is another example syntax.
ajay Duggi(Heptarc)ajay Duggi(Heptarc)
Dear Daniel,
I hope you will get cellpadding syntax from my previous post
Daniel RobertsDaniel Roberts
Does it require <apex:dataTable> component to work? The example that they provide doesn't require any additional components in the documentation. https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_pageBlockTable.htm
ajay Duggi(Heptarc)ajay Duggi(Heptarc)
Dear Daniel,
It is not require, I taken to show format of cellpadding.