You need to sign in to do that
Don't have an account?

Sorting Visualforce DataTable
Is it possible to sort the following with just a standard controller? I'd really like to sort by Product__r.Name, but would really like to keep it within Visualforce.
<apex:dataTable value="{!Contact.Positions__r}" var="b" rules="all" columns="3" columnsWidth="250px,250px" align="left" columnClasses="columnBorders" cellpadding="5px" cellspacing="0"> <apex:facet name="header">ACTIVE POSITIONS</apex:facet> <apex:column value="{!b.Product__r.Name}" headerValue="Product" rendered="{!b.isactive__c}"/> <apex:column value="{!b.Name}" headerValue="Account Name" rendered="{!b.isactive__c}"/> <apex:column value="{!b.Balance__c}" headerValue="Balance" rendered="{!b.isactive__c}"/> </apex:dataTable>Thanks!!!
Greetings!
I don't think it is possible.However,you can achieve this by using the controller/extension.
Please find the sample code below:
https://developer.salesforce.com/forums/?id=9060G000000I6i3QAC
http://sfdcsrini.blogspot.com/2014/09/sorting-tables-in-visualforce.html
Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.
Warm Regards,
Shirisha Pathuri