I am not sure if this is against the forum policy but just wanted to know from experienced people on what is the difference between pageBlockTable, dataTable and repeat?

This is what I have found so far on the interenet:


1) uses salesforce styling
2) No need to specify the headers
3) mandatory attribute "value".


1) Need to specify the headers
2) we can specify custom style classes.
3) No mandatory attribute "value" unlike in pageblockTable

I could not find much info on the apex:repeat


1 Answer 1


The four basic types, apex:pageBlockTable, apex:dataTable, apex:dataList, and apex:repeat are all basically the same thing, but present different renderings.

apex:pageBlockTable represents a table formatted and styled to look like a related list table.

apex:dataTable is an unstyled table suitable for use anywhere outside of a apex:pageBlock (but may be used within one).

apex:dataList renders a ul or ol element (unordered or ordered list, respectively), with li (list item) elements comprising the rows.

apex:repeat allows any arbitrary output based on a template. The four elements require value and var attributes, iterate over a collection of some sort, may generally be nested inside each other, and are limited to 1,000/10,000 rows of output, depending on the apex:page's readOnly attribute.

Edit: As pointed out in the comment, the main difference with apex:pageBlockTable, compared to the other three, is it must appear in a apex:pageBlock or apex:pageBlockSection, while the other types can be rendered anywhere that Visualforce is allowed. There's a very specific limitation about apex:pageBlock not being available in email templates, as well, so you'd naturally have to use one of the other three types of iterators.

  • 4
    n.b. "Several standard Visualforce components are not available for use within <messaging:emailTemplate>. These include <apex:detail>, <apex:pageBlock> and all related pageBlock components," -- no pageBlocktable in VF email templates
    – cropredy
    Commented Aug 3, 2015 at 17:31
  • @crop1645 I did mean to mention that, as well as the fact that apex:pageBlockTable can't just appear free-standing by itself, but actually has to be inside a apex:pageBlock.
    – sfdcfox
    Commented Aug 3, 2015 at 18:10
  • 1
    sfdcfox -- I was careful to use the n.b = nota bene = note well; take notice. - not meant as a criticism, just an addenda for some future reader of your answer
    – cropredy
    Commented Aug 3, 2015 at 19:23
  • 1
    also related article thephani.com/difference-between-pageblocktabe-datatable-repeat Commented Jun 6, 2016 at 16:49
  • @VitalyZdanevich Thanks for the suggested edit. I've also added reference links to the various objects.
    – sfdcfox
    Commented Jun 6, 2016 at 16:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .