Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fast Javascript Table sorter?

I have a table with about 250 rows (may double within 6 months), and 50 columns on this page (warning: slow with IE). I'm using the JQuery Table sorter. But it is too slow with IE 7: it gives a warning about a slow javascript, and ask if I want to stop it. I've spent a lot of time to improve performances, so it works fine for all other browsers:

  • sort text and digit only
  • removed all but 2 parsers
  • created an extra table that contains all the values, much faster than doing node.textContent() for each cell
  • removed lowercase, trim, etc.

My version of the javascript is here. I think I cannot optimize it much more. I am looking for another fast implementation of a table sorter, or any good optimization I may have forgot, so that IE 7 won't complain about the execution time.

Edit: I've disabled sorting on 35 columns, it is still too long for IE

like image 251
Julien Avatar asked Mar 14 '09 04:03

Julien


2 Answers

I use sorttable an extremely fast table sort javascript library. (not JQuery)

like image 188
Luis Melgratti Avatar answered Oct 13 '22 03:10

Luis Melgratti


I'm a big fan of Christian Bach's jQuery table sorter ... http://tablesorter.com/docs/

  • Compact and fast
  • Sort on multiple columns
  • Dynamic zebra stripe
  • Optional metadata extension makes things even easier
  • Parsers for sorting text, html, numbers, whatever (easy to customize)
  • CSS styleable headers (of course)
  • Cross-browser: IE 6.0+, FF 2+, Safari 2.0+, Opera 9.0+

enter image description here

EDIT: Anyone interested in tablesorter should see what Mottie has done with it: https://github.com/Mottie/tablesorter

like image 38
neokio Avatar answered Oct 13 '22 04:10

neokio