You need to sign in to do that
Don't have an account?
Collen Mayer 6
reRender Column Heading
Hi All,
I have a visual force page that allows a user to enter/edit their mileage expenses. All is working fine, but I'm needing to have a column heading rerender when a user hits a "refresh programs" button, but I'm not having any luck. Here is a simplified version of the page:
The refresh program button simply upserts the existing expense report record after the "program 1" field is changed (and this is working ). What I'm having problems with is getting the last column heading to rerender after the user changes program and hits the refresh program button. The last column heading, Expense_Report__c.Program_1_Number__c, is a formula field based on program 1. On a side note, if I refresh my browser after hitting refresh programs button, it does update the column heading, but I'm trying to do this without refreshing the whole page.
I'm new to visualforce so any help/advice is appreciated.
Best,
Collen
I have a visual force page that allows a user to enter/edit their mileage expenses. All is working fine, but I'm needing to have a column heading rerender when a user hits a "refresh programs" button, but I'm not having any luck. Here is a simplified version of the page:
<apex:page standardController="Expense_Report__c" extensions="addMileageExpense" sidebar="false" showHeader="true"> <apex:form > <apex:pageBlock title="Mileage Report" id="er" > <table> <tr> <td style="width:85px"> <h2>Program 1:</h2> </td> <td style="width:175px"> <apex:inputField value="{!Expense_Report__c.Program_1_Mileage_log__c}"> </apex:inputField> </td> <td><apex:commandButton value="Refresh programs" action="{!refreshProgram}" reRender="program_num"></apex:commandButton></td> </tr> </table> <apex:pageMessages /> <apex:variable var="rowNumber" value="{!0}"/> <apex:pageblockSection columns="1" > <apex:pageBlockTable title="Mileage Expenses" var="me" value="{!expenseList}" > <apex:column headerValue="Entry" style="width:20px; text-align:center;" headerClass="centertext"> <apex:outputText value="{0}" style="text-align:center;"> <apex:param value="{!rowNumber+1}" /> </apex:outputText> </apex:column> <apex:column headerValue="Date of trip" > <apex:inputField value="{!me.Date__c}" required="true"/> </apex:column> <apex:column headerValue="Purpose and Description" > <apex:inputField value="{!me.Name}" required="true"/> </apex:column> <apex:column headerValue="{! Expense_Report__c.Program_1_Number__c}" style="width:50px" id="program_num"> <apex:inputField value="{!me.Prgm_1_Miles__c}" style="width:50px"> </apex:inputField> </apex:column> </apex:pageBlockTable> </apex:pageblockSection> </apex:pageBlock> </apex:form> </apex:page>
The refresh program button simply upserts the existing expense report record after the "program 1" field is changed (and this is working ). What I'm having problems with is getting the last column heading to rerender after the user changes program and hits the refresh program button. The last column heading, Expense_Report__c.Program_1_Number__c, is a formula field based on program 1. On a side note, if I refresh my browser after hitting refresh programs button, it does update the column heading, but I'm trying to do this without refreshing the whole page.
I'm new to visualforce so any help/advice is appreciated.
Best,
Collen
All Answers
Try using below code for Command button:
-Thanks,
TK
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
In case its helpful, my underlying function for {!refreshProgram} is simply:
where reports is the expense report record.
So it turns out that my issue is that the heading that I'm trying to refresh is a formula field, and apparently the formula fields do not recalculate on reRender. Does anyone have thoughts on how I could do this? The formula field is based on a lookup field (Program) that I am updating.
-Thanks,
TK