Newer Version Available
Pagination with a List Controller
You can add pagination to a page using a list controller by utilizing
the next and previous actions. For example, if
you create a page with the following markup:
By default, a list controller returns 20
records on the page. To control the number of records displayed on
each page, use a controller extension to set the pageSize. For information on controller
extensions, see Building a Controller Extension.
1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<apex:page standardController="Account" recordSetvar="accounts">
18 <apex:pageBlock title="Viewing Accounts">
19 <apex:form id="theForm">
20 <apex:pageBlockSection >
21 <apex:dataList var="a" value="{!accounts}" type="1">
22 {!a.name}
23 </apex:dataList>
24 </apex:pageBlockSection>
25 <apex:panelGrid columns="2">
26 <apex:commandLink action="{!previous}">Previous</apex:commandlink>
27 <apex:commandLink action="{!next}">Next</apex:commandlink>
28 </apex:panelGrid>
29 </apex:form>
30 </apex:pageBlock>
31</apex:page>