Activity Forums Salesforce® Discussions Can we make nested page block table in Salesforce?

  • shariq

    July 19, 2017 at 1:02 pm

    I want to make page block table inside a page block table, how it can be done, please explain it with the example?

  • Aman

    July 19, 2017 at 1:33 pm

    Hello Shariq,

    yes ,we can make nested Page block table. you can refer to the below given visualforce Page and Apex class.

    visualforce Page

    <apex:page controller="SearchAccountCon" tabStyle="Account">
    <apex:form >
    <apex:pageMessages />
    <apex:inputText value="{!searchString}" />
    <apex:commandButton value="search" action="{!search}"/>
    <apex:pageBlock >
    <apex:pageBlockTable value="{!acct}" var="acc">
    <apex:column value="{!acc.Id}" />
    <apex:column value="{!acc.description}" />
    <apex:column >
    <apex:pageBlockTable value="{!acc.contacts}" var="c">
    <apex:column value="{!c.Id}"/>
    <apex:column value="{!c.LastName}"/>

    Apex class

    public class SearchAccountCon {
    public static String searchString {get; set; }
    public static List<Account> acct{get;set;}

    public static void search(){
    acct= Database.query('Select Name, description,(select id, Name,LastName From Contacts) From Account WHERE Name LIKE \'%'+searchString+'%\' Limit 100');
    catch(Exception e){
    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter Account site'));




  • Parul

    September 16, 2018 at 12:43 pm

    Yes, we can make nested page block table in Salesforce


    <apex:page controller="dbPracticeChangesController">
    <apex:form >
    <apex:pageblock >
    <apex:pageblocktable value="{!ChangeList}" var="cs">
    <apex:column headervalue="Competency">
    <apex:outputtext value="{!cs.Name}"/>
    <apex:column headervalue="Rollup Data">
    <apex:facet name="Facet Name">
    <apex:pageblocktable value="{!cs.dbPracticeChanges__r}" var="db">
    <apex:column headervalue="Name">
    <apex:outputtext value="{!db.Name}"/>
    <apex:column headervalue="Late Start">
    <apex:outputtext value="{!db.Late__c}"/>



Viewing 1 - 3 of 3 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos