I’ve been working on a project recently which requires some fairly complex sql joins and calculation gyrations which had me tearing my hair out to get everything to come out right. For some I ended up having to add content to the results programatically. On top of it all, the table columns had to be adjusted based on the result set – so the html layout I was given to work with just wasn’t flexible enough to handle the big variation in results. I was able to solve the whole thing very nicely with the jQuery tablesorter plugin and this scrollable table tool. As long as the results aren’t too long – less than 5000 records or so – I can skip sorting on the server side entirely and leave it to the browser. It certainly simplified the code a ton and the click to sort functionality is much smoother – no resorting to page refreshes to make it happen.
jQuery plugin: Tablesorter 2.0.
http://www.webtoolkit.info/scrollable-html-table-plugin-for-jquery.html
