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
Shanky77Shanky77 

Pagination-urgent

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">
{!a.name}
</apex:dataList>
</apex:pageBlockSection>
<apex:panelGrid columns="2">
<apex:commandLink action="{!previous}">Previous</apex:commandlink>
<apex:commandLink action="{!next}">Next</apex:commandlink>
</apex:panelGrid>
</apex:form>
</apex:pageBlock>
</apex:page>

 

 

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:commandLink>
                 </apex:facet>
                 <apex:outputField value="{!a.Name}"/>       
            </apex:column>  
 

 

 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??????

jeffdonthemic2jeffdonthemic2

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.
http://blog.jeffdouglas.com