Implementing pagination in salesforce using standardsetcontroller

Standard set controllers provided by salesforce makes it very easy to implement pagination in visualforce. Using standardset controller one can easily navigate through pages, move directly to first, last page or to next or previous pages. Its easy to set number of rows per page or get number of rows in current page. All we need to do is instantiate the StandardSetController and use the standard methods to leverage the pagination functionality. Below is an example that displays pagiantion for set of account records

       Visualforce Page

Some points that we need to consider while using standardset controllers are as below-
1. The maximum record limit for StandardSetController is 10,000 records.
2. Instantiating StandardSetController with a list of more than 10,000 records doesn’t throw an exception, and instead truncates the records to the limit.
3. One can instantiate a StandardSetController in either of the following ways:

 a]From a list of sObjects:

 b]From a query locator:

4. There are number of methods that are available in standardset controllers which can be used to manipulate the records as per requirements. You can navigate to this links to know about this methods -

No comments:

Post a comment