Friday, May 22, 2015

Simple wrapper class example.

public class Checkbox_Class 
{
    List accountList = new List();
    List selectedAccounts = new List();
        
    public List getAccounts()
    {
        for(Account a : [select Id, Name, AccountNumber, Phone from Account limit 5])
        accountList.add(new accountwrapper(a));
        return accountList;
    }
    
      
    public class accountwrapper
    {
        public Account acc{get; set;}
        public Boolean selected {get; set;}
        public accountwrapper(Account a)
        {
            acc = a;
            selected = false;
        }
    }
}

No comments:

Post a Comment