You need to sign in to do that
Don't have an account?
Kbhaskar
Wrapper class for displaying Checkbox and Field Label in two colums
hi,
Below is the code for displaying Checkbox and Field Label in two colums but i'm not able to see field name can anyone help me out !
Apex class
Below is the code for displaying Checkbox and Field Label in two colums but i'm not able to see field name can anyone help me out !
<!----------- Creating this page for dispaly Opportunity fields object in single table with check box ----------> <apex:page controller="WrapperIntStringDisplayClass"> <apex:form > <apex:pageBlock > <apex:pageBlockSection > <apex:pageBlockTable value="{!lstwrapperIntString}" var="w"> <apex:column headervalue="click2Select"> <apex:inputcheckbox /> </apex:column> <apex:column headervalue="Opportunity fields"> {!w.Id} {!w.Name} </apex:column> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Apex class
public with sharing class WrapperIntStringDisplayClass { // Creating lists for the object opportunity List<opportunity> lsttest = new List<opportunity>(); // Creating List for Wrapper class public List<wrapper> lstw = new List<wrapper>(); // Get method calling from PageBlockTable and return the list of wrapper to Table public List<wrapper> getLstwrapperIntString() { lsttest = [select Id, Name from opportunity]; for(Integer i=0;i<lstw .size();i++){ lstw.add(new wrapper(lsttest[i].Id,lsttest[i].Name)); } return lstw; } // Wrapper Class Construction public class wrapper{ public String Id{get;set;} public String Name{get;set;} // Wrapper class constructor public wrapper(String Id,String Name ){ this.Id=Id; this.Name=Name; } } }Visualforce page _
Please change your controller class with below class :
Let me know if you still have any issue.
Thanks,
Abhishek
All Answers
Please change your controller class with below class :
Let me know if you still have any issue.
Thanks,
Abhishek