We're adding some additional functions to an older tool which was originally built using the Lightning Design System on Visualforce. The stakeholder is requesting a sort function on a datatable which allows them to sort based on the Column headers.

I know this is pretty straightforward in Lightning, but does anyone have a good workable client-side JS solution that they can point me to for implementing this? We're not in a position to convert this tool to Lightning yet but I'd love to implement a Client side solution.

Thanks for your time!


I've used DataTables in Visualforce pages in the past. You get pagination and filtering more or less for free if you want those too.

A complication is handling the sorting of various data types - see Client-side sorting and pagination of an apex:pageBlockTable – more on sorting - because what is sorted is the rendered text string version of the values.

  • Great suggestion - just played around with it this morning and it meets my needs perfectly. Thanks! – cg13 Feb 7 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.