+ Start a Discussion
ChandanBiswasChandanBiswas 

wrapper class with checkbox

Below is the requirement:

->create a vf page which will display all account name in custom picklist
->when the user will select any account, all related opportunity will display in table with ckeckbox in first column of each row.
->There should be one master checkbox in header of the table to select all the opportunity
--> This display page should support pagination.
 
Vyankatesh ChoulwarVyankatesh Choulwar
Hi Chandan,

1. Create a VF page and custom controller.
2. In controllers constuctor query all accouns and store it in list<account>.
3. Display this list on vf page using selectlist
4. For selected account, bind account id to controller variable say 'selectedAccountId' and onSelect call a controller method
5. In controller method query all opporunities whose parent account is :selectedAccountId. Here you will get list<opportunity>
6. Create a Wrapper class and declare 2 members. 1 boolean say checked (make it false in wrapper class constructor) and 2nd Opportunity opp
5. Iterate over list<opportuniy> in step 5 using for each loop and create a wrapper record for each opportunity
6. Create table on vf page using apex:repeat iterate over wrapper list.
7. Header row checkbox bind with separate controller variable
8. Row level checkbox bind with wraper variable

Best Luck!