function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Pagination for Custom List



I am new to Apex / Visualforce, so will appreciate any help with the following. I have created a custom list using visual force to display all child accounts in a related list. I would like to repeat the same for Contacts of child accounts in the page for parent account.


Now, having done that, how do I implement pagination - if the number of contacts / child accounts is significant?


See my apex code below:


<apex:page standardController="Account" extensions="childAccount">


.fewerMore { display: none;}


<apex:form >

 <apex:pageMessages />

 <apex:detail relatedList="true"></apex:detail>

<apex:pageblock id="CustomList" title="Child Accounts"  >

   <apex:pageBlockTable value="{!acctz}" var="o" rendered="{!NOT(ISNULL(acctz))}">

        <apex:column headerValue="Action" >

            <apex:outputLink value="/{!}/e?retURL=/apex/{!$CurrentPage.Name}" style="color:blue; text-decoration:none">Edit</apex:outputLink>


        <apex:column headerValue="Name"> <apex:outputLink value="/{!}">{!o.Name}</apex:outputLink> </apex:column>

        <apex:column value="{!o.Address_Street__c}"/>

        <apex:column value="{!o.Address_City__c}"/>

    <apex:column value="{!o.Office__c}"/>

        <apex:column value="{!o.Type}"/>


   <apex:outputLabel value="No records to display" rendered="{!(ISNULL(acctz))}"></apex:outputLabel>









public class childAccount {


    private List<Account> acctz;

    private Account acct;


    public childAccount(ApexPages.StandardController controller) {

        this.acct= (Account)controller.getRecord();



    public List<Account> getAcctz()


        Account act = [Select id FROM Account where id =];

        acctz = [Select id, Name, Address_Street__c, Address_City__c, Office__c, Type from Account where parentid =];

    return acctz;





Try using StandardSetController.

Cannot you not use Pagination in a StandardController?

HI ppiyush,

     I have similar requirement for pagination for custom related list.Please tell me how you fixed this pagination issue.