Activity Forums Salesforce® Discussions What is the difference between apex:pageBlockTable and apex:dataTable in Salesforce?

  • shradha jain

    Member
    August 27, 2018 at 1:22 pm

    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 pageblockTable

    Thanks.

  • shariq

    Member
    September 17, 2018 at 10:00 pm

    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.

  • Parul

    Member
    September 18, 2018 at 8:34 pm

    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 explicitly

    Apex: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 automatically

     

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos