Fields that are required in other Salesforce objects will keep the same requiredness when used by the prototype object.
List<account> accountList = [SELECT Name FROM Account LIMIT 20];
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(accountList);
ApexPages.StandardSetController ssc =
new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Name,CloseDate FROM Opportunity]));
The maximum record limit for StandardSetController is 10,000 records. Instantiating StandardSetController using a query locator returning more than 10,000 records causes a LimitException to be thrown. However, instantiating StandardSetController with a list of more than 10,000 records doesn’t throw an exception, and instead truncates the records to the limit.
public class opportunityList2Con { // ApexPages.StandardSetController must be instantiated // for standard list controllers public ApexPages.StandardSetController setCon { get { if(setCon == null) { setCon = new ApexPages.StandardSetController(Database.getQueryLocator( [SELECT Name, CloseDate FROM Opportunity])); } return setCon; } set; } // Initialize setCon and return a list of records public List<Opportunity> getOpportunities() { return (List<Opportunity>) setCon.getRecords(); } }
<apex:page controller="opportunityList2Con"> <apex:pageBlock> <apex:pageBlockTable value="{!opportunities}" var="o"> <apex:column value="{!o.Name}"/> <apex:column value="{!o.CloseDate}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:page>
The following are constructors for StandardSetController.
public StandardSetController(Database.QueryLocator queryLocator)
public StandardSetController(List<sObject> controllerSObjects)
List<account> accountList = [SELECT Name FROM Account LIMIT 20];
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(accountList);
The following are methods for StandardSetController. All are instance methods.
public System.PageReference cancel()
Type: System.PageReference
public Boolean getCompleteResult()
Type: Boolean
public String getFilterId()
Type: String
public Boolean getHasNext()
Type: Boolean
public Boolean getHasPrevious()
Type: Boolean
public System.SelectOption getListViewOptions()
Type: System.SelectOption[]
public Integer getPageNumber()
Type: Integer
public Integer getPageSize()
Type: Integer
public sObject getRecord()
Type: sObject
public sObject[] getRecords()
Type: sObject[]
public Integer getResultSize()
Type: Integer
public sObject[] getSelected()
Type: sObject[]
public Void previous()
Type: Void
public System.PageReference save()
Type: System.PageReference
public Void setFilterID(String filterId)
Type: Void
public Void setpageNumber(Integer pageNumber)
Type: Void
public Void setPageSize(Integer pageSize)
Type: Void
public Void setSelected(sObject[] selectedRecords)
Type: Void