Newer Version Available
setSelected(selectedRecords)
Set the selected records to the records specified in the
selectedRecords argument.
Signature
public Void setSelected(sObject[] selectedRecords)
Parameters
- selectedRecords
- Type: sObject[]
Return Value
Type: Void
Usage
Use the setSelected() method in your Apex controller or controller extension to manually set the records displayed on a Visualforce page. The setSelected() method overwrites any previously selected records with the records specified in the selectedRecords argument.
Example
AccountNamePage shows a table of account names. MyControllerExtension’s constructor contains a SOQL query that returns a list of accounts. This list is passed into setSelected() so that the account records in the list are selected and displayed in the table.