public class AccConOppWrapperC {
public List<OppWrapper> Opplist = new List<OppWrapper>();
public List<ContactWrapper> ctclist = new List<ContactWrapper>();
public String SelectedValue { get; set; }
public string recid{get;set;}
public List<Account> Accs {
get{
List<Account> AccName = new List<Account>();
for(Account a :[Select Id, name, phone, rating from Account limit 10]){
AccName.add(a);
}
return AccName;
}
}
public PageReference refresh(){
Opplist.clear();
ctclist.clear();
for(Account a :[Select id,name, phone, rating,(Select name,stagename, closedate from opportunities), (Select Name, phone, email from contacts) from Account where Id =:recId]){
for (opportunity opp :a.opportunities) {
Opplist.add(new OppWrapper(false,opp));
}
for (Contact c : a.contacts) {
ctclist.add(new ContactWrapper(false,c));
}
}
return null;
}
public List<OppWrapper> getOppList(){
System.debug('count' + Opplist.size());
return Opplist;
}
public List<ContactWrapper> getCtcList(){
System.debug('count' + ctcList.size());
return ctcList;
}
public class OppWrapper{
public Boolean selected { get; set; }
public Opportunity opp { get; set; }
public OppWrapper(Boolean selected1, Opportunity opp1){
selected = selected1;
opp = opp1;
}
}
public class ContactWrapper{
public Boolean selected { get; set; }
public Contact c { get; set; }
public ContactWrapper(Boolean selected, Contact c){
this.selected = selected;
this.c = c;
}
}
}
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Greetings to you!
Please try the below code, I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
Visualforce:
Controller:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas