Austin Munro
Austin Munro

Reputation: 333

Sorting results from a mysql query without submitting new query

So I have a database with 50 or so lenses and their attributes. I have a simple php script to let the user enter in min and max values from none/some/all of the attributes and then display a table with the corresponding lenses. What I'd like to be able to do is after the lenses are displayed is to have the legend clickable to sort the lenses and their attributes. I've done a bit of searching but can't find anything implemented easily.

Upvotes: 2

Views: 153

Answers (2)

Jordan Speizer
Jordan Speizer

Reputation: 573

This jQuery plugin has built in AJAX functionality that could be useful in your case:

http://datatables.net/

Upvotes: 0

Eric J.
Eric J.

Reputation: 150118

Given the small number of results you want to re-sort, you can certainly do that in the web browser rather than making a round-trip back to the server.

If you can use jQuery, there are a number of grid controls that allow for sorting in the web browser, e.g.:

http://tablesorter.com/docs/

Search for jquery grid sortable to find many other options.

Upvotes: 4

Related Questions