I have a CommandButton when the user clicks it adds the selected records and post it to the controller but it repaint the entire page and I'm wondering how can I do using async in VFP without reloading the entire page?

   <apex:pageblock id="Selected_PBS" title="{!IF(SelectedContacts != NULL && SelectedContacts.size > 0,'Selected Contact','There are no records selected')}">   
        <div align="center" style="padding:15px;" rendered="{!IF(SelectedContacts != NULL && SelectedContacts.size > 0,'Selected Contact','There are no records selected')}">            
              <apex:commandButton value="Add to Work Order!" action="{!addToWO}" disabled="{!If(selectedContacts != null && selectedContacts.size > 0,false, true)}" />
        <apex:pageBlockTable value="{!SelectedContacts}" var="contact" rendered="{!IF(SelectedContacts != NULL && SelectedContacts.size > 0,true,false)}">
             <apex:column value="{!contact.Name}"/>
             <apex:column value="{!contact.Email}"/>
             <apex:column value="{!contact.Phone}"/>
  • Add a rerender to the command button
    – Eric
    Jul 20, 2015 at 19:50
  • rerender what exactly?
    – Nick
    Jul 20, 2015 at 19:53
  • just what ever you need to or nothing at all. But it does not make a good user experience to execute an action and have absolutely no indicator on the page that it actually happened. If you choose to serenader nothing simply add rerender=""
    – Eric
    Jul 20, 2015 at 19:54

1 Answer 1


You can use the rerender attribute on the tag. Give your pageBlockTable an id, then you can do something like:

<apex:commandButton rerender="[myPageBlockTableId]" ... /> 

This should make your action an ajax call.

Alternatively you can create remote actions in your controller and handle the dom manipulation yourself with a different client side framework. It's more low level but gives you more control.

  • i have implemented and let me play little bit more and see and also i have posted another question related to this but i have divided my question into two so the second question is here if you wanna look at it: salesforce.stackexchange.com/questions/84122/…
    – Nick
    Jul 20, 2015 at 20:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .