Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

public with sharing class Pagination {

Public Integer noOfRecords{get; set;}


Public Integer size{get;set;}
public ApexPages.StandardSetController setCon {
get{
if(setCon == null){
size = 10;
string queryString = 'Select Name, Type, BillingCity, BillingSta
te, BillingCountry from Account order by Name';
setCon = new ApexPages.StandardSetController(Database.getQueryLo
cator(queryString));
setCon.setPageSize(size);
noOfRecords = setCon.getResultSize();
}
return setCon;
}set;
}
Public List<Account> getAccounts(){
List<Account> accList = new List<Account>();
for(Account a : (List<Account>)setCon.getRecords())
accList.add(a);
return accList;
}
public pageReference refresh() {
setCon = null;
getAccounts();
setCon.setPageNumber(1);
return null;
}
public Boolean
get {
return
}
set;
}
public Boolean
get {
return
}
set;
}

hasNext {
setCon.getHasNext();

hasPrevious {
setCon.getHasPrevious();

public Integer pageNumber {


get {
return setCon.getPageNumber();
}
set;
}
public void first() {
setCon.first();
}
public void last() {
setCon.last();
}

public void previous() {


setCon.previous();
}
public void next() {
setCon.next();
}
}

You might also like