Sortable table v1.5

I’ve just updated my sortable table script to version 1.5, in which it is fixed to work in Safari for Mac OS X 10.4 as well, (I didn’t even know that it wasn’t working in there since it always worked in the nightly). I’m now taking new feature requests for this script, so hit me with them, in the comments or by e-mail.

Tags:


Yoast.com runs on the Genesis Framework

Genesis theme frameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides you with the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Read our Genesis review or get Genesis now!

10 Responses

  1. João CostaBy João Costa on 6 January, 2007

    Nice script you have here. Let me suggest some possible improvements:

    - Correctly sort numbers such as: 9.9999997E-20, 1.0000000E-10 and 9.9999997E-06 or 1.0997E+06.

    - Allow show/hide of individual columns, and store in a cookie which columns are visible for next time same page is opened (a bit tricky, but doable).

  2. Joost de ValkBy Joost de Valk on 7 January, 2007

    Hey João, thx for the great ideas, the first would be hard i think, the second sounds like a lot of work but doable indeed :)

  3. João CostaBy João Costa on 7 January, 2007

    The first is actually quite simple to implement, since Javascript can cope with the scientific numeric format. For instance, you can just change line 110 from:

    if (itm.match(/^[\d\.,\-]+$/)) sortfn = ts_sort_numeric;

    to:

    if (itm.match(/^[\d\.,\-]+(E[-+][\d]+)?$/)) sortfn = ts_sort_numeric;

    The regular expression can probably be optimized, but this one works on Firefox 1.5 and IE 6 in Windows.

  4. Joost de ValkBy Joost de Valk on 7 January, 2007

    Hmm cool, do you have some table where i can test this? :)

  5. FrantiÅ¡ek MalinaBy FrantiÅ¡ek Malina on 29 April, 2007

    Thank you for your plug and play script, I love it.

    Please, do not spend your time with any new features. It is perfect AS IT IS. I now use it with near any table where applicable. It ads boring data good user expereince without any server side scripting.

    See it in action on
    http://www.rrg-group.com/ucl/ucl_Home.asp

  6. FrantiÅ¡ek MalinaBy FrantiÅ¡ek Malina on 29 April, 2007

    I forgot, click any car to see its review.

    I also used it to sort items in a shopping cart, used car reviews, product listings. I tried lot of scripts to do this, but your JS is out of the box goodness.

  7. The BebosBy The Bebos on 1 June, 2007

    Very Nice… Wonderful

    But .. with an integration like mysql …. for example..

    while ($mr=mysql_fetch_array($data)){
    echo “”.$mr["field1"].””;
    echo “”.$mr["field2"].””;
    echo “”.$mr["field3"].””;
    }

    is possible ?

  8. The BebosBy The Bebos on 1 June, 2007

    Sorry …

    echo “” -> td and tr … /td and /tr

    I have changed my phpscript but don’t work…

  9. ShaneBy Shane on 5 June, 2007

    I love this script! It’s been a lifesaver.

    I’ve got a column with time and date ( 8:45pm 05/03/07) and it makes a mess of sorting. Any suggestions?

    My first thought was to hack together some way to sort by a hidden value, perhaps sort by td id. Then I could make the id the unix timestamp and it would always sort correctly.

    Thanks again for a fantastic script!

  10. Joost de ValkBy Joost de Valk on 5 June, 2007

    Shane: if you turn around date and time, it might work…