+ Start a Discussion
BaktashBaktash 

Order List in Visualforce Email Template

Hello,

 

ich have list in a VF Email template and I would like to know if it is possible to order the list.

It looks like this:

 

<messaging:emailTemplate subject="Subject" recipientType="Contact" relatedToType="Opportunity"> 

<messaging:attachment renderAs="PDF">

<apex:dataTable var="o" value="{!relatedTo.testObject__r}">
<apex:column headerClass="AngeboteTableHeader"  value="{!o.Field__c}"/>
</apex:dataTable>

 

I need to order the datatable by a specific field. is it possible?

 

Thanks in advance.

kiranmutturukiranmutturu

native sorting is not there..but u can try in another way using components u can build the page...in that page u can  make use of jquery to do that sortings...but i am not sure whether this will work in the output, as this is email template..

Abhay AroraAbhay Arora

No the sorting will not work if jquery is used because when you will send the email most of the servers will disable js as a security measure.

 

You can just sort the data on your email template before sending it that is the only option you have .