+ Start a Discussion
Henry AkpalaHenry Akpala 

How to represent the checkbox of a StandardSetController on a VFP

Please I am trying to figure out how to create a VFP that shows the "Action" (Checkbox) field that is normally visible on a list page.



Henry AkpalaHenry Akpala
Just to clarify, I am trying to use getSelected, setSelected methods of StandardSetController. But just wanted to understand how you can represent that on a VFP with the checkbox that is normally the first column.
Rehan DawtRehan Dawt

Hi HenryAG,


Check this below code:


Controller :

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, IsPrivate, CloseDate FROM Opportunity]));
            return setCon;

    // Initialize setCon and return a list of records
    public List<Opportunity> getOpportunities() {
        return (List<Opportunity>) setCon.getRecords();

 Page :


<apex:page controller="opportunityList2Con">
        <apex:pageBlockTable value="{!opportunities}" var="o">
            <apex:column value="{!o.Name}"/>
            <apex:column value="{!o.CloseDate}"/>
            <apex:column value="{!o.IsPrivate}"/>



Henry AkpalaHenry Akpala

Thanks for you update but that does not address my problem.

What I am trying to do is to show a checkbox like is normally shown on standard list page in VFP.  Was going to attach a screenshot but there is no option to do so.

the heading will have a checkbox that allows you to "Select All" or you can check any specific record from the list to perform an action on.