Activity › Forums › Salesforce® Discussions › What is the difference between apex:pageBlockTable and apex:dataTable in Salesforce?
Tagged: Apex DataTable, Apex PageBlockTable, Attribute Value, Custom Style Classes, Difference, Salesforce Styling
-
What is the difference between apex:pageBlockTable and apex:dataTable in Salesforce?
Posted by madhulika shah on August 27, 2018 at 1:19 PMWhat is the difference between apex:pageBlockTable and apex:dataTable in Salesforce?
Parul replied 7 years, 7 months ago 4 Members · 3 Replies -
3 Replies
-
Hello Madhulika,
The difference between apex:pageBlockTable and apex:dataTable are:
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.
- [adinserter block='9']
-
Hi,
Added few points more –
PageBlockTable:
- PageBlockTable should be define 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.
Hope this helps.
-
Hi
Apex:dataTable –
An HTML table that is defined by iterating over a set of data, displaying information about one item of data per row. The body of the < apex:dataTable > contains one or more column components that specify what information should be displayed for each item of data. The data set can include up to 1,000 items.->no need to write inside <apex:pageblock> or <apex:pageblocksection>
-> there is no required value
-> the data can be displayed using custom styles
-> we need to specify column headers explicitlyApex:pageBlockTable – A list of data displayed as a table within either an < apex:pageBlock > or < apex:pageBlockSection > component, similar to a related list or list view in a standard Salesforce page. Like an < apex:dataTable >, an < apex:pageBlockTable > is defined by iterating over a set of data, displaying information about one item of data per row. The set of data can contain up to 1,000 items.The body of the < apex:pageBlockTable > contains one or more column components that specify what information should be displayed for each item of data, similar to a table. Unlike the < apex:dataTable > component, the default styling for < apex:pageBlockTable > matches standard Salesforce styles. Any additional styles specified with < apex:pageBlockTable > attributes are appended to the standard Salesforce styles. ->pageblocktable should be inside of <apex:pageblock> or <apex:pageblocksection>
-><apex:pageblocktable> has a required attribute called “value”
->it uses the standard salesforce page styles
->column headers will be displayed automaticallyThanks.
Log In to reply.