+ Start a Discussion


For the pagination we have to use


<apex:page standardController="Account" recordSetvar="accounts">
<apex:pageBlock title="Viewing Accounts">
<apex:form id="theForm">
<apex:pageBlockSection >
<apex:dataList var="a" value="{!accounts}" type="1">
<apex:panelGrid columns="2">
<apex:commandLink action="{!previous}">Previous</apex:commandlink>
<apex:commandLink action="{!next}">Next</apex:commandlink>



but in my case code is


<apex:pageBlockTable value="{!fetchMaxRec}" var="a" id="tab">

           <apex:column >
                 <apex:facet name="header">
                       <apex:commandLink value="{!$ObjectType.Account.Fields.Name.Label}" action="{!CommonSortIt}">
                             <apex:param name="CurrentGetSetSortFields" value="Name" assignTo="{!CurrentGetSetSortFields}"/>
                 <apex:outputField value="{!a.Name}"/>       


 Since Pevious and Next is standard button of Account. But i m using custom method "fetchMaxRec" so it is

not supporting. One more issue is , I am not able to use dataList for my code to proceed with the pagination

 because the way dataList has been used in the 1st piece of code , in the same way PageBlockTable has been used in my case.


How to resolve it??????


I have a blog post with Visualforce and Apex code for pagination. There is also a working demo you can run.

Visualforce Page With Pagination 

It should get you working in the right direction.

Jeff Douglas
Appirio, Inc.