Activity Forums Salesforce® Discussions Difference between using Datatable vs. Pageblocktable tags?

  • Anjali

    Member
    September 13, 2018 at 1:23 pm

    Hi Anurag,

    Only standard style sheets can be used in apex:pageBlockTable tag in Visualforce page.

    <apex:pageBlockTable> must be contained in <apex:pageBlock> or <apex:pageBlockSection>.

    If we want to add custom style sheets we have to use apex:dataTable tag in Visualforce page.

  • Parul

    Member
    September 13, 2018 at 1:27 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.

  • madhulika shah

    Member
    September 13, 2018 at 1:31 pm

    Hi Anurag,

    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.

  • shariq

    Member
    September 13, 2018 at 1:33 pm

    Hi,

    PageBlock: For default salesforce standard format.

    dataTable:To design customformats

    Thanks

Log In to reply.

Popular Salesforce Blogs