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
Vikram Singh 157Vikram Singh 157 

HEllo ! I am trying to get idea that how Pagination work, but code didn't work , please suggest..

<apex:page standardController="Contact" recordSetVar="contacts">
   <apex:form >
    <apex:pageBlock title="Contacts List" id="contacts_list">
<apex:selectList value="{! filterId }" size="1">
    <apex:selectOptions value="{!listViewOptions }"/>
    <apex:actionSupport event="onchange" reRender="contacts_list"/>
        <apex:pageBlockTable value="{! contacts }" var="ct">
            <!-- Pagination -->
            <table style="width: 100%"><tr>

                Page: <apex:outputText value=" {!PageNumber} of {!CEILING(ResultSize/PageSize)}"/>

    <td align="center">
<apex:commandLink action="{! Previous }" value="« Previous"
     rendered="{!HasPrevious }"/>
<apex:outputText style="color: #ccc;" value="« Previous"
     rendered="{! NOT(HasPrevious) }"/>

<apex:commandLink action="{! Next }" value="Next »"
     rendered="{!HasNext }"/>
<apex:outputText style="color: #ccc;" value="Next »"
     rendered="{!NOT(HasNext) }"/>    </td>
    <td align="right">
Records per page:
<apex:selectList value="{!PageSize }" size="1">
    <apex:selectOption itemValue="5" itemLabel="5"/>
    <apex:selectOption itemValue="20" itemLabel="20"/>
    <apex:actionSupport event="onchange" reRender="contacts_list"/>
</apex:selectList>    </td>

            <apex:column value="{! ct.FirstName }"/>
            <apex:column value="{! ct.LastName }"/>
            <apex:column value="{! ct.Email }"/>
            <apex:column value="{! ct.Account.Name }"/>
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Vikram Singh,

May I suggest you please refer the below link for reference. let  us know if it helps.

Please mark it as best answer if the information is that question is removed from an unanswered question and appear as a proper solution.

Rahul Kumar