Simple Pagination in Visualforce Page (display 3 records per page)
Page:
<apex:page sidebar="false" standardController="Candidate__c" recordSetVar="candidateRecords" extensions="candidateController">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value="{!candidateRecords}" var="cr">
<apex:column headerValue="NAME">
{!cr.Name}
</apex:column>
<apex:column headerValue="COUNTRY">
{!cr.Country__c}
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:commandLink value="Previous" action="{!previous}"/>
<apex:commandLink value="Next" action="{!next}"/>
</apex:pageBlock>
</apex:form>
</apex:page>
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value="{!candidateRecords}" var="cr">
<apex:column headerValue="NAME">
{!cr.Name}
</apex:column>
<apex:column headerValue="COUNTRY">
{!cr.Country__c}
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:commandLink value="Previous" action="{!previous}"/>
<apex:commandLink value="Next" action="{!next}"/>
</apex:pageBlock>
</apex:form>
</apex:page>
Class:
public with sharing class candidateController {
public candidateController(ApexPages.StandardSetController controller) {
controller.setpagesize(3);
}
}
public candidateController(ApexPages.StandardSetController controller) {
controller.setpagesize(3);
}
}
Comments
Post a Comment