Activity Forums Salesforce® Discussions What is the main difference between using data table vs .page block table tags ?

  • What is the main difference between using data table vs .page block table tags ?

    Posted by Prachi on September 21, 2018 at 5:36 am

    What is the main difference between using data table vs .page block table tags ?

    Parul replied 6 years, 2 months ago 3 Members · 3 Replies
  • 3 Replies
  • shariq

    Member
    September 21, 2018 at 7:25 am

    Hi,

    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

    Hope this helps.

  • shariq

    Member
    September 21, 2018 at 7:27 am

    Hi,

    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 varattributes, 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.

    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.

    Thanks

  • Parul

    Member
    September 21, 2018 at 7:32 am

    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