Tablesorter 2.0 : Simple table sorter with jQuery

Here’s something we’re always ask : “Can we see the list in the order we want?” In a programmer’s language, it means that the client wants to be able to sort a HTML table by clicking on the header row. You have two choices : server-side or client-side. If you choose server-side, you’ll have to query all the data to the DB with a different “ORDER BY” clause. That’s not nice for your DB and your DBA will probably hate you. If you choose client-side, you’ll have to write A LOT of code. That is not nice for your phalanges and they will probably hate you.

God finally sent us a third option : Tablesorter 2.0 (a jQuery plugin).

It’s easy to use and it just works! Take a look at the simplest example possible and don’t forget there’s a lot more to do.

  • http://www.rubyfleebie.com FrankLamontagne

    Wow, great find… and it is blazing fast. I wonder if it can keep up the speed when there are like 500+ table rows

  • Dan Simard

    @FrankLamontagne
    They have a 1022 rows example and it’s still fast.

  • BK

    I think it may be important to remind that you have to get ALL elements in the table meaning you can’t use paging with this approach (unless I missed something)

  • Dan Simard

    Hmmmm… looks like you’re missing something

  • Keith

    Actually, BK is correct… that is to say, if paging is used to prevent 1M records from traveling down the pipe. I/you probably don’t want to deal with sending this number of records/rows to a user.

    I have used these paging and sorting addons both together and indivually… very slick. The only problem i found is when you place the sorter within a div with overflow vertical allowed to scroll. The header for some reason jumps to the top of the page… which made me go another direction. Other than that… priceless.

    =)

    is slick and