function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
eric_wceric_wc 

pageBlockTable order by date

I am still learning visual force and I cannot for the life of me figure out how to order the results of the below code by the createddate field? 
 

 

 

<apex:page standardController="Case">

<!-- ALL COMMENTS -->

<apex:pageBlock title="Case Comments" id="allCommentsPB">

<apex:pageBlockSection title=" " columns="1" id="allCommentsPBS">

<apex:pageBlockTable value="{!case.CaseComments}" var="comment" >

<apex:column value="{!comment.IsPublished}"/>

<apex:column value="{!comment.CreatedDate}"/>

<apex:column value="{!comment.CreatedById}"/>

<apex:column value="{!comment.CommentBody}"/>

</apex:pageBlockTable>

</apex:pageBlockSection>

</apex:pageBlock>

</apex:page>

 


 

 
 
Thanks in advance.
 
Eric 
Message Edited by eric_wc on 02-03-2010 03:23 AM
Message Edited by eric_wc on 02-03-2010 03:24 AM
bob_buzzardbob_buzzard
The pageblocktable will iterate over case.caseComments in the order that they have been retrieved.  If you wish to order things differently, you will need to create a list ordered as per your requirements and use that to back the pageblocktable.