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
Frank CarterFrank Carter 

Unable to Rerender PageBlockTable

Hi Every One,

I have created a Vf page, with inline editing,  wrapper class and delete button. When I select records and the delete the page dosen't refresh  so I've setted the Rerender on the pageBlock but it does't work. Can someone help me?

vf page
<apex:page controller="WrapperDemoControllerBill" lightningStylesheets="true" docType="html-5.0">
<apex:form > 
            <apex:pageBlock title="test" >

            
            

                <apex:commandButton value="Delete" style="text-align:left;" onclick="if(!confirm('If you click ok all the selected billing details will be delated. Are you sure? ')) return false;" action="{!toDelete}" reRender="pb" />
            </div>        
        </apex:pageBlock>
<apex:pageBlock mode="inlineEdit" id="pb"  >
    <apex:pageBlockSection columns="1" >
       
        <apex:pageBlockTable value="{!wpList}" var="wp" >
            <apex:column headerValue="Action">
                <apex:inputCheckbox value="{!wp.check}"/>
            </apex:column>
           <apex:column Headervalue="SF OPPORTUNITY ID" >
            <apex:outputfield value="{!wp.bill.SF_Opportunity_Id__c}"/>
           </apex:column>
            <apex:column headervalue="BILLING TYPE">
            <apex:outputfield value="{!wp.bill.Billing_Type__c}"/>
             </apex:column>
             <apex:column headervalue="BILLING PERIOD">
            <apex:outputfield value="{!wp.bill.Billing_Period__c}"/>
            </apex:column>
            <apex:column headervalue="MONTHLY FORECAST">
            <apex:outputfield value="{!wp.bill.Monthly_Forecast__c}"/>
            </apex:column>
            <apex:column headervalue="END OF BILLING">
            <apex:outputfield value="{!wp.bill.End_of_Billing__c}"/>
            </apex:column>
            <apex:column headervalue="AMOUNT">
            <apex:outputfield value="{!wp.bill.Amount__c}"/>
            </apex:column>
             <apex:column headervalue="STATUS">
            <apex:outputfield value="{!wp.bill.Billing_Status__c}"/>
            </apex:column>           
        </apex:pageBlockTable>


    </apex:pageBlockSection>
       <apex:pageBlockButtons > 

            <apex:commandButton value="Save" action="{!save}" id="saveButton" />

        </apex:pageBlockButtons>
</apex:pageBlock>

</apex:form>
</apex:page>
apex class
public class WrapperDemoControllerBill{
public Billing_Detail__c bil{get;set;}
public  Date StartDate {get;set;}
public  Date EndDate {get;set;}
public List<Billing_Detail__c> bilList{get;set;}

public List<WrapperClass> wpList{get;set;}

public WrapperDemoControllerBill(){
    wpList = new List<WrapperClass>();
    bilList = [Select Id,SF_Opportunity_Id__c, Name,Billing_Type__c, Billing_Period__c , Monthly_Forecast__c,End_of_Billing__c, Amount__c, Billing_Status__c   from Billing_Detail__c ]; 

    String bilId = ApexPages.CurrentPage().getParameters().get('id');
    if(bilId != null){
        bil = [Select Id,SF_Opportunity_Id__c, Name,Billing_Type__c, Billing_Period__c , Monthly_Forecast__c,End_of_Billing__c, Amount__c, Billing_Status__c   from Billing_Detail__c where id =: bilId limit 1];    
    }else{
       bil = new Billing_Detail__c();
    }

    for(Billing_Detail__c bil : bilList){
        WrapperClass wp = new WrapperClass();
        wp.bill = bil;
        wp.check = false;
        wplist.add(wp);
    }

}

public PageReference Save(){

   // insert bil;
  List<Billing_Detail__c> lstBilling = new List<Billing_Detail__c>();
  //iterate over wrapper and get all billing
  for(WrapperClass objWrapper: wpList){
        lstBilling.add(objWrapper.bill);
   }

  //update list
  upsert lstBilling;



 ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'LAST NAME IS MISSING PLEASE ENTER.');
 ApexPages.addMessage(myMsg);
 return null;

}

public PageReference toDelete(){

   // insert bil;
  List<Billing_Detail__c> lstBilling = new List<Billing_Detail__c>();
  //iterate over wrapper and get all billing
  for(WrapperClass objWrapper: wpList){
      if(objWrapper.check==true)
        lstBilling.add(objWrapper.bill);
   }

  //update list
  delete lstBilling;



 ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'LAST NAME IS MISSING PLEASE ENTER.');
 ApexPages.addMessage(myMsg);
 return null;

}
    
    
    

    
    
    
    
    
public class WrapperClass{
    public Boolean check{get;set;}
    public Billing_Detail__c bill{get;set;}
}

}


 
Raj VakatiRaj Vakati
try this code .. keep the logic in apex:outputPanel and render it 
 
<apex:page controller="WrapperDemoControllerBill" lightningStylesheets="true" docType="html-5.0">
<apex:form > 
            <apex:pageBlock title="test" >

            
            

                <apex:commandButton value="Delete" style="text-align:left;" onclick="if(!confirm('If you click ok all the selected billing details will be delated. Are you sure? ')) return false;" action="{!toDelete}" reRender="pb" />
            </div>        
        </apex:pageBlock>
		
		<apex:outputPanel id="pb">
		
<apex:pageBlock mode="inlineEdit"   >
    <apex:pageBlockSection columns="1" >
       
        <apex:pageBlockTable value="{!wpList}" var="wp" >
            <apex:column headerValue="Action">
                <apex:inputCheckbox value="{!wp.check}"/>
            </apex:column>
           <apex:column Headervalue="SF OPPORTUNITY ID" >
            <apex:outputfield value="{!wp.bill.SF_Opportunity_Id__c}"/>
           </apex:column>
            <apex:column headervalue="BILLING TYPE">
            <apex:outputfield value="{!wp.bill.Billing_Type__c}"/>
             </apex:column>
             <apex:column headervalue="BILLING PERIOD">
            <apex:outputfield value="{!wp.bill.Billing_Period__c}"/>
            </apex:column>
            <apex:column headervalue="MONTHLY FORECAST">
            <apex:outputfield value="{!wp.bill.Monthly_Forecast__c}"/>
            </apex:column>
            <apex:column headervalue="END OF BILLING">
            <apex:outputfield value="{!wp.bill.End_of_Billing__c}"/>
            </apex:column>
            <apex:column headervalue="AMOUNT">
            <apex:outputfield value="{!wp.bill.Amount__c}"/>
            </apex:column>
             <apex:column headervalue="STATUS">
            <apex:outputfield value="{!wp.bill.Billing_Status__c}"/>
            </apex:column>           
        </apex:pageBlockTable>


    </apex:pageBlockSection>
       <apex:pageBlockButtons > 

            <apex:commandButton value="Save" action="{!save}" id="saveButton" />

        </apex:pageBlockButtons>
</apex:pageBlock>


</apex:outputPanel>
</apex:form>
</apex:page>