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
John DaJohn Da 

Apex:Repeat In Same Order As Related List In Page Layout

Hi,

So in my page layout, I have a related list (child object) that is sorted by "priority" variable. When I create a PDF VisualForce page, I use apex:repeat to loop through that relaled list and display all the records. It works fine and all, except the order of this apex:repeat is the order of when the record is creaed (not the order of priority). Is there a way I can use apex:repeat to have the same order as the page layout (sorted by Priority)? Can this be done without Apex (right now I just use a Standard Controller)? Thanks.
KaranrajKaranraj
Currently there is no standard attribute in repeat tag for the sorting. Vote for this Idea - https://success.salesforce.com/ideaView?id=08730000000BrZ0

Still if you don't want to use apex controller for sorting, then you can do it by javascript, check this link for the sorting child records in apex:repeat tag using javascript http://salesforce.stackexchange.com/questions/9091/sort-order-of-child-records-using-a-standard-controller
David OvellaDavid Ovella

can you post your code?

In my apex I used this code: ORDER BY

 from Linea_de_detalle__c Where OT__c = :this.ot.id ORDER BY Grupo__c]: