- 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.
Edit: I've disabled sorting on 35 columns, it is still too long for IE
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+
EDIT: Anyone interested in tablesorter should see what Mottie has done with it: https://github.com/Mottie/tablesorter
Commenting out any references to applyWidget and their respective bindings as well as removing unused parsers made a big difference to a 500 row table in IE6 (yeah, I know, but it still won't die).
Most JScript solutions that work slow have a lot of interaction with the DOM. At the moment that you're doing DOM-level edits row-per-row it will take long in IE. If you're building the HTML in a string and then put it at once in the DOM, it'll go a lot quicker. (There were some demos at the last PDC showing exactly that.)
But the moral of the story here is that your table is quite big. You might think of using REST, with table paging and sorting and some server-side logic. I think that can be a lot quicker and will work fine with JQuery. (And it is still an AJAX solution.) It might even save you some bandwidth...
Hope this helps.
One of the worst things you can do is use eval() and I see that in your code. You should profile your code and see where the bottleneck is.
A great and robust option is this jQuery plugin, called DataTables.
- Variable length pagination
- On-the-fly filtering
- Multi-column sorting with data type detection
- Smart handling of column widths
- Scrolling options for table viewport
- Fully internationalisable
- jQuery UI ThemeRoller support
- Rock solid - backed by a suite of 2900 unit tests
- Wide variety of plug-ins inc. Editor, TableTools, FixedColumns and more
- It's free!
If you are working with seriously large databases try server side with DataTables (jQuery plugin).
Basically all of the paging, filtering, sorting etc that DataTables does can be handed off to a server (or any other data source).
Full example here: http://datatables.net/examples/data_sources/server_side.html
Problem in the function buildCache(table) Line 219 Error : 'all_data' non defined