Newer Version Available
StandardSetController Class
StandardSetController objects allow you to create list controllers similar to, or as extensions
of, the pre-built Visualforce list controllers provided by Salesforce.
Namespace
ApexPages
Usage
The StandardSetController class also contains a prototype
object. This is a single sObject contained within the Visualforce StandardSetController class. If
the prototype object's fields are set, those values are used during the save action,
meaning that the values are applied to every record in the set controller's
collection. This is useful for writing pages that perform mass updates
(applying identical changes to fields within a collection of objects).
Instantiation
You can instantiate
a StandardSetController in either of the following ways:
- From a list of sObjects:
- From a query locator:
Example
The following example shows how
a StandardSetController object can be used in the constructor for
a custom list controller:
The following Visualforce markup shows how the controller above can be used in a page: