+ Start a Discussion

what is difference between the standardlistcontroller and standardsetcontroller?

William TranWilliam Tran
Standard controllers are out of the box controllers that contain the same functionality and logic that are used for standard Salesforce pages. For example, if you use the standard Accounts controller, clicking a Save button in aVisualforce page results in the same behavior as clicking Save on a standard Account edit page.

When working with a single record from an SObject you can use the standard controller.

But when working with large datasets, the StandardSetController really is the way to go since it stores dataset on the server, which reduces page state and helps to increase performance. It is designed to work efficiently with lots of data. 

As a common practice, if your question is answered, please choose 1 best answer. 
But you can give every answer a thumb up if that answer is helpful to you. 


Santosh Kumar 275Santosh Kumar 275

Standard List Controller : Standard list controllers allow you to create Visualforce pages that can display or act on a set of records without writing any controller or extention.Example : Displaying name of all the account without query or without writing any controller.

For example, to associate a page with the standard list controller for accounts, use the following markup:

<apex:page standardController="Account" recordSetVar="accounts">

The recordSetVar attribute not only indicates that the page uses a list controller, it can indicates the variable name of the record collection. This variable can be used to access data in the record collection.

Now you can use this variable "accounts" to access the list of account.

<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
  <apex:pageBlock >
    <apex:pageBlockTable value="{!accounts}" var="a">
      <apex:column value="{!a.name}"/>

For further details like what all objects are supported and how you can use this in code refer this link : https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_about.htm

StarndardSetController : StandardSetController is a class in salesforce which is basically use for achiving pagination.
There are number of methods pressent in this class using which you can acheive the pagination efficiently.

Refer this link https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/apex_pages_standardsetcontroller.htm

As common practicse if your question is answered marked it as Best answer.