Issue status update for http://drupal.org/node/30150 Post a follow up: http://drupal.org/project/comments/add/30150 Project: Drupal Version: cvs Component: base system Category: feature requests Priority: normal Assigned to: Steven Reported by: Steven Updated by: Steven Status: patch (code needs review) The structure just mimics the existing stuff really (like autocomplete.js): the autoattach deals with seeking out suitable targets and installing the event handler. The tablesort object is just there to provide a persistent data storage for handling the asynchronous request. I suppose once we've found a table we could create a tablesort object and then seek out the relevant links and header cells in there, but I don't see a problem with doing that in the autoattach either. Steven Previous comments: ------------------------------------------------------------------------ Wed, 31 Aug 2005 22:39:36 +0000 : Steven Attachment: http://drupal.org/files/issues/jstablesort.patch (12.93 KB) This patch adds Ajax-based tablesorting to tablesort.inc. Note that this is /not/ client-side sorting, which isn't that useful in Drupal as most sortable tables are paged. Of course, given that it still requires a round-trip to the server, the biggest advantage is in visual usability, as only the table itself changes and not the entire page. The way this is accomplished will probably strike you as very elegant, or very dirty ;). In order to avoid patching up every instance of a sortable table and providing a custom Ajax menu callback for each, I made it so that inside theme('table'), the tablesort can cause the table to be printed immediately and PHP to quit. This is triggered by the GET variable 'tablesort', when set to the table's id. So, the Ajax HTTP request visits the exact same page as the original page, it only adds something to the URL which triggers this special behaviour. It works really well. In fact, the id-per-table wouldn't be necessary if we restricted ourselves to one sortable table per page. ------------------------------------------------------------------------ Wed, 31 Aug 2005 23:04:38 +0000 : Steven Attachment: http://drupal.org/files/issues/jstablesort_0.patch (13.25 KB) Missed a table in statistics.module ;). ------------------------------------------------------------------------ Wed, 31 Aug 2005 23:11:35 +0000 : Thox I haven't tested the patch, only glimpsed through it for now. The JS-side seems fine. I'm a little curious why tablesortAutoAttach() does all the hard work, I imagined the tablesort object could do that for itself. +1 on the concept.