Tuesday, January 28, 2014

What is the difference between “apex:dataTable” and “apex:pageBlockTable” components in Visualforce

What is the difference between “apex:dataTable” and “apex:pageBlockTable” components in Visualforce

Both component is used to render data in tabular format. dataTable will render records in simple HTML table format whereas the “pageBlockTable” possess default look and feel of salesforce standard CSS and must be written inside “apex:pageBlock” componet.
You can read more here.

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.

No comments:

Post a Comment