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
khillan bhardwajkhillan bhardwaj 

Sorting OpportunityLineItem by Date in either sort direction

Dear sir ,


  the following code show list of OpportunityLineItem . is there is any possible way to sort this list by date or name.means accending or Decending Order . 

i know we can do such thing by using controller but i want to do this without any controller means either we can use javascript code in vf page. if u have solution then plz let me know


<apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">

No, there's no way to do that with the Apex repeat tag. You should already have your data sorted in the order you want, defined in a controller or extension, prior to iterating over it.

Ok this can be done.
But you may have to change your tags a lil bit.

I already created something similar for pageblock tables. Have a look at this blog

You can grab the code and change it according to your needs