It has two primary uses: (1) to display a paginated list of records from a query containing up to 2,000 rows, and (2) to allow mass inline editing of those records or some subset (via "selected records"). To facilitate both functions, it allows a developer to use an existing list view that can be exposed directly in Visualforce as a drop-down, and has a "prototype" object that will set all selected records' fields to the same value as the prototype when the save function is called on the StandardSetController. I'd advise reading the documentation, it should be fairly self-explanatory.
2. Useful for writing pages that perform mass updates (applying identical changes to fields within a collection of objects).
Pagination:-
As the number of records increases, the time required for the browser to render them increases. Paging is used to reduce the amount of data exchanged with the client. Paging is typically handled on the server side (standardsetcontroller). The page sends parameters to the controller, which the controller needs to interpret and then respond with the appropriate data set.
Example:-
Here is the controller which makes use of standard set controller for pagination
public with sharing class Pagination_min {
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, BillingState, BillingCountry from Account order by Name';
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(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;
}
}
/**Using the above controller methods we can define the pagination.**/
Hi,
Uses of StandardSetController:-
1. Pagination
2. Useful for writing pages that perform mass updates (applying identical changes to fields within a collection of objects).
Pagination:-
As the number of records increases, the time required for the browser to render them increases. Paging is used to reduce the amount of data exchanged with the client. Paging is typically handled on the server side (standardsetcontroller). The page sends parameters to the controller, which the controller needs to interpret and then respond with the appropriate data set.
Example:-
Here is the controller which makes use of standard set controller for pagination
/**Using the above controller methods we can define the pagination.**/