You need to sign in to do that
Don't have an account?
JasonRogers
In the above code, I am just trying to create an alternative opportunities related list for accounts adding in as many fields as we would like. When I use the apex:column elements with date fields the values output are in a long date format (with time and timezone). If I put an apex:outputField in the apex:column the date is formatted in short format but then the header disappears.
Is there any way to format date fields in an apex:pageBlockTable element as short form and keep the header of the column?
I have tried using the header attribute in the column as well, but to no avail.
pageBlockTable headers disappear when using outputField in a column
Code:
<apex:page standardController="Account"> <apex:pageBlock title="Opportunities"> <apex:form > <apex:pageBlockTable value="{!account.Opportunities}" var="opty"> <apex:column > <apex:commandLink rerender="detail"> <apex:param name="opty_id" value="{!opty.id}" /> <apex:param name="render_details" value="true" /> {!opty.Name} </apex:commandLink> </apex:column> <apex:column value="{!opty.StageName}"/> <apex:column value="{!opty.Type}"/> <apex:column value="{!opty.CloseDate}"/> <apex:column value="{!opty.License_Start_Date__c}"/> <apex:column value="{!opty.ExpirationDate__c}"/> <apex:column value="{!opty.Rollup_Amount__c}"/> <apex:column value="{!opty.Rollup_New_Amount__c}"/> <apex:column value="{!opty.Rollup_Renew_Amount__c}"/> <apex:column value="{!opty.Rollup_One_Time_Amount__c}"/> <apex:column value="{!opty.Owner.Name}"/> <apex:column value="{!opty.Active_Status__c}"/> </apex:pageBlockTable> </apex:form> </apex:pageBlock> <apex:outputPanel id="detail"> <apex:actionStatus startText="Looking up Opportunity..."> <apex:facet name="stop"> <apex:detail subject="{!$CurrentPage.parameters.opty_id}" relatedList="false" title="false" rendered="{!$CurrentPage.parameters.render_details}" /> </apex:facet> </apex:actionStatus> </apex:outputPanel> <!-- End Default Content REMOVE THIS --> </apex:page>
The bug with header facets should be fixed very soon.
However as mentioned you should be able to use headerValue="Date" on the column, and instead of value, but an outputField in the column.
Thanks. Using the above approach indeed worked. Now, if we could only do that on currency fields as well!