+ Start a Discussion
dkorba2k5dkorba2k5 

Detail Section Rerender

OK ... I must be missing something.  I have the following VF page and it works great except that I can't seem to figure out how to get the <apex:detail> section to rerender after saving records into the database.  Only the pageblock is rerendering.  So I need basically a full page rerender after saving.  Thanks

Code:
<apex:page StandardController="Timesheet__c" extensions="TimeSheetDetails" tabStyle="Timesheet__c" sidebar="true" standardStylesheets="true" showHeader="true" id="page">
<style>
.dim_a {width:300px; font-family: Verdana; font-size: 10px; font-weight: normal;}
.tabletext {font-family: Verdana; font-size: 10px; font-weight: normal;}
</style>
  <apex:detail relatedList="False"/>
  <apex:form >
        <apex:pageBlock title="Timesheet Details Edit">
        <apex:pageBlockButtons >
            <apex:commandButton value="Save"  action="{!save}" rerender="rows status="outStatus"/>
            <apex:commandButton value="Add"   action="{!add}" rerender="rows" status="outStatus"/>
            <apex:commandButton value="Reset" action="{!reset}" rerender="rows" status="outStatus" immediate="true" />
            <br>&nbsp
            <apex:actionStatus startText="(.................working.................)" stopText="" id="outStatus" onstop="Reset"/>
        </apex:pageBlockButtons>
            <apex:pageBlockTable border="1" cellpadding="2" value="{!entries}" var="a" id="rows" styleClass="tabletext"> 
                <apex:column width="20px"><apex:inputField value="{!a.Del__c}" required="false" styleClass="tabletext"/> <apex:facet name="header">Remove</apex:facet> </apex:column>
                <apex:column width="270px"><apex:inputField value="{!a.Description__c}" required="false" styleClass="dim_a"/> <apex:facet name="header">Description</apex:facet> </apex:column>
                <apex:column width="30px"><apex:inputField value="{!a.Start_Date__c}" required="true" styleClass="tabletext"/> <apex:facet name="header">Start Date</apex:facet> </apex:column>
                <apex:column width="30px"><apex:inputField value="{!a.End_Date__c}" required="true" styleClass="tabletext"/> <apex:facet name="header">End Date</apex:facet> </apex:column>
                <apex:column width="10px"><apex:inputField value="{!a.Quantity__c}" required="true" styleClass="tabletext"/> <apex:facet name="header">Billable Hrs</apex:facet> </apex:column>
                <apex:column width="10px"><apex:inputField value="{!a.Non_Billable_Qty__c}" required="false" styleClass="tabletext"/> <apex:facet name="header">Non-Billable Hrs</apex:facet> </apex:column>
   </apex:pageBlockTable>
        </apex:pageblock>
    </apex:form>
</apex:page>

 

jwetzlerjwetzler
You're only telling it to rerender "rows", which is the pageBlockTable.  It's doing what you've asked it to do.

If you want a full page refresh, bind to quickSave instead of save, and remove your rerender attribute.

(Also if you did not notice, you did not close the rerender="rows" attribute with a double quote for your save button.
dkorba2k5dkorba2k5
Jill - thanks for your quick reply.  Yeah I did notice when I cut and paste I missed that one quotation mark.  So that wasn't the issue.  So here's the issue.  My callout to Save goes to my own controller extension code .. see following.  So how would I accomplish the whole page refresh while still preserving my save function?  New to VF still so appreciate the guideance.

Code:
public PageReference save() 
{
    Timesheet_Entries__c entry = new Timesheet_Entries__c();
    upsert entryList;

    reset();
    return null;
}

 

jwetzlerjwetzler
The answer is still the same.  You have to remove your rerender attribute, because that tells your page which section to rerender.  It's not going to refresh your page if you're telling it to only rerender a portion of it.
dkorba2k5dkorba2k5
yeah I understand the fact that the rerender is only doing the id it's referring to.  But when I remove the rerender then it doesn't do any refresh.  Plus I don't see quickSave as an option for a controller action
jwetzlerjwetzler
quickSave is a standardController method.  It calls save but returns null instead of returning you to the detail page.  Since you are overriding the save action you don't need to call quick save.

Try removing status too?  As long as you are returning null and taking no other ajax actions you should get a full page refresh.
dkorba2k5dkorba2k5
ok ... how about this .. I added this to my save() function and it worked fine.  Any issues with this?

Code:
        PageReference pageRef = new PageReference('/' + ApexPages.currentPage().getParameters().get('id'));
        pageRef.setRedirect(true);
        return pageRef;