You need to sign in to do that
Don't have an account?
amrit
How to create wrapper classes?
Hi ,
Here i trying to create a wrapper class for multiple objects.But when i triedto save the class it is showing this error Unexpected token '{'
public class wrapperClassController { public List<wrapperClassController>wrapperClassList{get;set;} public List<Payment_Schedule__c> ps{get;set;} public id oppId; public wrapperClassController (ApexPages.StandardController controller) { oppId = Apexpages.CurrentPage().getParameters().get('id'); } public List<wrapperClassController> getSR() { if(wrapperClassList == null) { wrapperClassList = new List<wrapperClassController>(); for(Payment_Schedule__c ps : [select Name,Display_Order__c,Tentative_Due_Date__c,Installment_Value_in__c,Balance__c,Installment_Basic_Value__c,VAT__c,Service_Tax__c,Deposits_Other_Charges__c,Total__c,Due_Date__c,Opportunity__r.Name,Payment_Received__c from Payment_Schedule__c where Opportunity__c =: oppId Order By Display_Order__c]) { wrapperClassList.add(new wrapperClassController(ps)); } } return wrapperClassList; } public PageReference processSelected() { List<Payment_Schedule__c> selectedPayment= new List<Payment_Schedule__c>(); for(wrapperClassController cCon :getSR()) { if(cCon.selected == true) { selectedPayment.add(cCon.con); } } System.debug('These are the selected paymentschedule..'); for(Payment_Schedule__c con : selectedPayment) { system.debug(con); } return null; } public wrapperClassController {//showing error (Unexpected token) public Payment_Schedule__c con {get; set;} public Boolean selected {get; set;} public wrapperClassController(Payment_Schedule__c c) { con = c; selected = false; } } }
Can anyone find soution for this
Thanks
Amrit
hi,
u should declear class before class name and better u give some other name to wrapper class
public class wrapperClassController
public wrapperClassController
{//showing error (Unexpected token)
public Payment_Schedule__c con {get; set;}
public Boolean selected {get; set;}
public wrapperClassController(Payment_Schedule__c c)
{
con = c;
selected = false;
}
}