Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Demo page for Visualforce and tablesorter
<apex:page sidebar="true" controller="TableSortingCtrl">
<apex:includeScript
value="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" />
<apex:includeScript
value="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.8/js/jquery.tablesorter.min.js" />
<apex:stylesheet
value="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.17.8/css/theme.blue.css" />
<apex:datatable value="{!accounts}" var="acc" id="accsTable" styleclass="tablesorter">
<apex:column headerValue="Created">
<apex:outputText value="{0, date, dd/MM/yyyy}">
<apex:param value="{!acc.CreatedDate}" />
</apex:outputText>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField value="{!acc.Name}" />
</apex:column>
<apex:column headerValue="Street">
<apex:outputField value="{!acc.BillingStreet}" />
</apex:column>
<apex:column headerValue="City">
<apex:outputField value="{!acc.BillingCity}" />
</apex:column>
<apex:column headerValue="State">
<apex:outputField value="{!acc.BillingState}" />
</apex:column>
<apex:column headerValue="Postcode">
<apex:outputField value="{!acc.BillingPostalCode}" />
</apex:column>
</apex:datatable>
<script>
$(document).ready(function()
{
$("[id$='accsTable']").tablesorter({theme: 'blue', dateFormat : "dd/mm/yyyy"});
});
</script>
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment