You need to sign in to do that
Don't have an account?

Refresh VisualForce PageBlock
The following is a simplified version of a table that sits in the page layout of the Case standard object.
<apex:page standardController="Case" extensions="aResourcesListController"> <apex:form > <apex:pageBlock id="table1"> <apex:pageBlockTable value="{!aResourcesList}" var="aResource" > <apex:column > <apex:facet name="header">Column 1</apex:facet> <apex:inputField value="{!aResource.field__c}"/> </apex:column> <apex:column > <apex:facet name="header">Column 1</apex:facet> <apex:outputText value="{!aResource.field__r.someOtherField}"/> </apex:column> </apex:pageBlockTable> <br/> <apex:commandButton action="{!updateTable}" value="Save" rerender="table1"/> <apex:commandButton action="{!insertRow}" value="New" rerender="table1"/> </apex:pageBlock> </apex:form> </apex:page>
This should update the table when the Save commandButton is clicked. It does update the database but to get the visualforce page to update the user must manually refresh the whole page. How can I get the VisualForce PageBlock to refresh when the user clicks save? Is this possible to do without refreshing the entire page?
Thanks,
Matt
There's nothing in the docs to say that a pageblock can't be rerendered, so I'd expect your save to work, assuming you aren't trying to redirect to a different page from your action method.
Usually when I see this behaviour it means that an error has been encountered, but the rerender stops it being displayed.
A couple of things to try, highlighted below:
The first will display any error messages that may have occurred, while the second will allow you to see that the request starts and finishes correctly.
If all looks good at that point, try wrapping your pageblock in an outputPanel and rerendering that.
You can also create a getter method of "aResourcesList". For e.g.
Please let me know if there is any issue.
Thanks,
Devendra
Blog
Thanks Bob,
This did display the start then stop text and the objuct was still updated but the other fields:
remain blank untill the page is refreshed. I also tried:
at the end of the updateTable function (and changed the type from void to PageReference) but that just returns a blank page segment. I replaced the above example with:
and that code did work, returning the google home page in a page segment.
Is there a way I can just refresh the entire page after the updateTable function is called?
Ok that makes sense, I have a lookup field and pull down a bunch of fields from the looked up record. As there are other page elements that use data recorded in this table, it looks like the easiest corse of action would be a full page refresh once the user saves the table. Sorry if this sounds like a ridiculously straightfoward question but is there a way of refreshing the entire page once the update function is called? (not just the page element)
Hello,
Please provided the contoller code as well.