Skip to content

Instantly share code, notes, and snippets.

@keirbowden
Created September 20, 2014 14:51
Show Gist options
  • Save keirbowden/f30ebd66c0e5a5008dbf to your computer and use it in GitHub Desktop.
Save keirbowden/f30ebd66c0e5a5008dbf to your computer and use it in GitHub Desktop.
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