function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
neil_edwards_fcca1.389781386123482E12neil_edwards_fcca1.389781386123482E12 

Checkbox in Visualforce - Rerendering problem

HI - Im using a visualforce page and wrapper classes to create three data tables. Table1 allows you to select a record(s) from a custom object. This then feeds into table 2 which filters based on the records selected in Table 2.   Table 3 is a list of records selected from records checked in Table2.  This table will form the basis of an Insert process into the custom object.

Tables 1 & 2 work fine, however I cannot for the life of me get table to rerender properly. I'm not sure of the problem is in the controller or the visualforce page but I'm suspecting a simple error I'm overlooking somewhere.

Any ideas??

Thanks in advance
public with sharing class Incentive_Checkbox_Class {

    public Incentive_Checkbox_Class(ApexPages.StandardController controller) {

    }

 List<string> Sections = new List<string>{'Fees','ATM','Penalties'};

 
 List<wrapper1> List1 = new List<wrapper1>();
 List<wrapper2> List2 = new List<wrapper2>();
 List<wrapper3> List3 = new List<wrapper3>();
 
Set<id> List3UniqueId = new Set<id>();
 
 List<Playbook_Category__c> SelectedList1 = new List<Playbook_Category__c>();
 List<Playbook__c> SelectedList2 = new List<Playbook__c>();

     
            
    public List<wrapper1> getList1()
    {
        list1.clear();
        for(Playbook_Category__c aList1 : [select Id, Name from Playbook_Category__c where Type__c not in:sections order by name ASC])
        List1.add(new wrapper1(aList1));
        return List1;
    }
    
    public List<wrapper2> getList2()
    {
       list2.clear();
       for(Playbook__c aList2: [select id,name,Desirability__c,Playbook_language__c,Category__c from Playbook__c where Category__c in :SelectedList1 order by category__r.name,Desirability__c,name ASC ])
        List2.add(new wrapper2(aList2));
        return List2;
    }
    
    public List<wrapper3> getList3()
    {
      List3.clear();
      for(Playbook__c aList3: [select id,name,Desirability__c,Playbook_language__c,Category__c from Playbook__c where id in :List3UniqueId order by category__r.name,Desirability__c,name ASC ])
                 
        List3.add(new wrapper3(aList3));
        return List3;
    }
    
    
    public PageReference getSelected()
    {
        SelectedList1.clear();
        
        for(wrapper1 ctwrapper :List1) {
        if(ctwrapper.selected1 == true) {
        SelectedList1.add(ctwrapper.acc1);
        }
        }
        list2.clear();
        return null;
    }
    
     public PageReference getSelected2()
    {
   
        for(wrapper2 ctwrapper2 :List2){
        if(ctwrapper2.selected2 == true){
        List3UniqueId.add(ctwrapper2.acc2.id);
        
           }
        }
       
        return null;
    }
    
     public PageReference getSelected3()
    {
        List3UniqueId.clear();
        for(wrapper3 ctwrapper3 :List3){
        if(ctwrapper3.selected3 == true){
        List3UniqueId.add(ctwrapper3.acc3.id);
           }
        }
        
        return null;
    }
    
          
    public class wrapper1
    {
        public Playbook_Category__c acc1{get; set;}
        public Boolean selected1 {get; set;}
        public wrapper1(Playbook_Category__c a1)
        {
            acc1 = a1;
         
        }
    }
    
     public class wrapper2
    {
        public Playbook__c acc2{get; set;}
        public Boolean selected2 {get; set;}
        public wrapper2(Playbook__c a2)
        {
            acc2 = a2;
           
        }
    }
    
    public class wrapper3
    {
        public Playbook__c acc3{get; set;}
        public Boolean selected3 {get; set;}
        public wrapper3(Playbook__c a3)
        {
            acc3 = a3;
        
        }
    }
}

======================================================

<apex:page standardcontroller="Payments__c" tabstyle="Payments__c" showheader="true" standardstylesheets="true" extensions="Incentive_Checkbox_Class"> 

<apex:form >


<apex:pageBlock Title="New Playbook Compliant Incentives and Marketing Contractual terms">

<table><tr><td>

<apex:dataTable value="{!List1}" var="a" columnswidth="50px,50px" cellpadding="4" border="1">
<apex:column >

<apex:inputCheckbox value="{!a.selected1}" id="checked1">
<apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS"/>
</apex:inputCheckbox>
</apex:column>
<apex:column headervalue="Category Name" value="{!a.acc1.Name}" />

</apex:dataTable>
</td><td>
<apex:dataTable value="{!List2}" var="s" columnswidth="50px,50px" cellpadding="4" border="1" id="Selected_PBS">
<apex:column >
<apex:facet name="header"></apex:facet>
<apex:inputCheckbox value="{!s.selected2}" id="checked2">
<apex:actionSupport event="onclick" action="{!GetSelected2}" rerender="test"/>
</apex:inputCheckbox>
</apex:column>
<apex:column headervalue="Category" value="{!s.acc2.Category__c}" />
<apex:column headervalue="Type" value="{!s.acc2.Desirability__c}" />
<apex:column headervalue="Playbook Term" value="{!s.acc2.Name}" />
<apex:column headervalue="Contractual Language" value="{!s.acc2.Playbook_language__c}" />

</apex:dataTable>

</td></tr></table>


<apex:pageblocksection title="Playbook Terms to Insert" columns="1" >

<apex:dataTable value="{!List3}" var="s3" columnswidth="50px,50px" cellpadding="4" border="1" id="test">
<apex:column >
<apex:facet name="header"></apex:facet>
<apex:inputCheckbox value="{!s3.selected3}" id="checked3">
<apex:actionSupport event="onchange" action="{!GetSelected3}" rerender="test"/>
</apex:inputCheckbox>
</apex:column>
<apex:column headervalue="Category" value="{!s3.acc3.Category__c}" />
<apex:column headervalue="Type" value="{!s3.acc3.Desirability__c}" />
<apex:column headervalue="Playbook Term" value="{!s3.acc3.Name}" />
<apex:column headervalue="Contractual Language" value="{!s3.acc3.Playbook_language__c}" />

</apex:dataTable>


</apex:pageblocksection>

</apex:pageBlock>
</apex:form>

</apex:page>

Best Answer chosen by neil_edwards_fcca1.389781386123482E12
neil_edwards_fcca1.389781386123482E12neil_edwards_fcca1.389781386123482E12
Did a re-write of the Apex controller and now works fine.