Hi havenboy,
The absolute easiest way to handle this in Dreamweaver is to convert the PHP recordset to an XML recordset and display the data using Spry. Spry tables can be made to sort very easily and it does not require reloading the page. The link above uses jQuery to accomplish the same effect. jQuery is a different (and more powerful) AJAX library than Spry.
There are extensions that will do it, but they usually are not free:
http://www.tom-muck.com/ex
The next easiest thing to do is to make the table headers into links that will pass a query string variable back to the SQL query.
<th><a href="?sortby=lname"></th>
and combine that with an Advanced Recordset that sets a variable based on $_GET['sortby'] in the ORDER BY clause:
SELECT *
FROM table
ORDER BY colname ASC
where colname is:
Name: colname
Type: text
Default value: somecolumn name
Run-time Value: $_GET['sortby']
So when the page is first loaded, the $_GET['sortby'] is not set, so the recordset will be sorted by the column defined in the Default Value. Once a header is clicked, the page will reload and should sort by the column clicked assuming you set the values correctly.
The problem with this approach is that if you are paginating the recordset (and you are), it gets a bit harder to work with. My link above will replace the query string completely and reset the pagination in the process. However, the sort stays enabled, so it does work.
Main Topics
Browse All Topics





by: yauhingPosted on 2009-09-05 at 07:54:36ID: 25266468
You can try tablesorter.
s/
http://tablesorter.com/doc