Activity › Forums › Salesforce® Discussions › What is the main difference between data table vs page block table tags in salesforce?
Tagged: apex:dataList, apex:dataTable, apex:pageBlockTable, apex:repeat, Attribute Value, Data Table, Email Template, Page Block Table, Pageblocksection, Salesforce Styling, Visualpage
-
What is the main difference between data table vs page block table tags in salesforce?
Posted by Laveena on September 23, 2019 at 12:54 PMWhat is the main difference between data table vs page block table tags in salesforce?
Prachi replied 6 years, 7 months ago 4 Members · 3 Replies -
3 Replies
-
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.
- [adinserter block='9']
-
Hi Laveena,
PageBlockTable:
PageBlockTable should be defined inside pageblock or pageblocksection.
PageBlockTable uses standard styles sheets to design a visualpage.
It has the required attribute “value”.
Column headers will be displayed automatically.DataTable:
No need to write inside pageblock or pageblocksection.
There is no required value.
The data can be displayed using custom style sheets.we need to specify column headers explicitly.
Thanks.
-
Hi Laveena,
apex:pageBlockTable-
1) uses salesforce styling
2) No need to specify the headers
3) mandatory attribute “value”.apex:dataTable-
1) Need to specify the headers
2) we can specify custom style classes.
3) No mandatory attribute “value” unlike in pageblockTableThanks.
Log In to reply.