Activity › Forums › Salesforce® Discussions › Can we make nested page block table in Salesforce?
Tagged: Apex PageBlockSection, Apex PageBlockTable, pageBlockTable, Salesforce Apex, Salesforce Customization
-
Can we make nested page block table in Salesforce?
Posted by shariq on July 19, 2017 at 1:02 PMI want to make page block table inside a page block table, how it can be done, please explain it with the example?
Parul replied 7 years, 8 months ago 3 Members · 2 Replies -
2 Replies
-
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:pageBlockTable>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>Apex class
public class SearchAccountCon {
public static String searchString {get; set; }
public static List<Account> acct{get;set;}public static void search(){
try{
acct= Database.query(‘Select Name, description,(select id, Name,LastName From Contacts) From Account WHERE Name LIKE \’%’+searchString+’%\’ Limit 100′);
system.debug(‘ddd’+acct);
}
catch(Exception e){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,’Please enter Account site’));
}
}}
- [adinserter block='9']
-
Yes, we can make nested page block table in Salesforce
Ex:
<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>
<apex:column headervalue=”Rollup Data”>
<apex:facet name=”Facet Name”>
</apex:facet>
<apex:pageblocktable value=”{!cs.dbPracticeChanges__r}” var=”db”>
<apex:column headervalue=”Name”>
<apex:outputtext value=”{!db.Name}”/>
</apex:column>
<apex:column headervalue=”Late Start”>
<apex:outputtext value=”{!db.Late__c}”/>
</apex:column>
</apex:pageblocktable>
</apex:column>
</apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>Thanks
Log In to reply.