Assuming the dataset is small (under a couple hundred items), I would grab all of the data with AJAX, then process and display it with JavaScript. Please, however, don't use plain JavaScript unless you have lots of experience with it. There are just too many ways to go horribly wrong. Use
jQuery instead. It will make the AJAX (requesting data from the server without leaving the page) trivially easy and it will also simplify the updating of the DOM (the page).
The ideal way for the server to send the data would be
JSON, since processing it in JavaScript is almost trivial.
The advantage of using JavaScript rather than a server-side language is that when the user wants to sort, it can happen immediately without having to reload the page. This will also save a lot of unnecessary requests to your server.
So basically your process would be something like this:
User visits page. JavaScript (with jQuery) on page requests data from server. Server pulls the data out of the database and formats it into a JSON document. JavaScript (with jQuery) on page receives data and processes it into a table. When the user clicks something, JavaScript (with jQuery!) responds and updates the table without reloading the page or re-requesting the data.
__________________
Some things are meant together, some things are better apart
Some things are easy, when other times they are hard
But that doesn’t mean what’s hard isn’t what’s meant to be
-
Al Lewis