Contact
May 19 2008

Sorting SSNs with Jquery Tablesorter

I ran into a situation today where I had to sort Social Security Numbers (yes, I know, storing SSNs is a no-no) in a table. I use the wonderful Jquery Tablesorter plugin by Christian Bach and it works beautifully, generally.

The problem arose, because in the presentation of the SSNs in the table, they are formatted like most Americans expect, 123-45-6789. However, when the tablesorter started doing the sorting, it actually performed the arithmetic on the field and sorted the result, rather than the string. I post this because, admittedly, it took me quite a while to figure out how the sort was behaving, and maybe this will save someone else some time.

Continue reading