function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Where to use list and where to use set controllers?

I am quite confused about  use cases of standard list and set controllers.I see std set cntrl has much  more flexibility and additional methods(hasnext()..etc) which makes pagination and many more things quite simple.These both controllers seem to have almost same functionality .Yeah ,I see std set controller is standalone (doesn't require std cntrl ).Can anybody please let me know some use cases which can  draw the hard difference  line between the  two explaining where to use std set and where to use std List cntrls.  Any useful comment is highly appreciated! Thanks in advance!
Hi  Ramlakhan,

StadradList controller is a pre-built Visualforce list controllers . You can use that with the help of recordSetVar Attribute in apex page component .
1.You have only few methods like (save,quickSave,List,cancel,first,last,next,previous ) ,but in standrad Set controller you have more number of method you can add record size page number etc in page which is not possible in standrad list controller .
2.In Set controller you can add filter in records but in list controller you can n't .It will pull all records from object  .
3.You can instantiate set controller with argument as lsit and Database.QueryLocator as well .
4.Basically  assume in your related list of Account you have one custom object or stadrad object (like contact) you want to add one button to mass edit or mass delete of records .
In this case you can use both standradset controller and StandradList controller ,However list controller you can pull all records .set controller you can select the check box and pull or else you can add filter  in query  to get records .

Also you can create a search page with teh help of set and list controller but set controller is more flexible then list controller .
For more information you can check below links