View Full Version : sortable table

02-01-2007, 01:11 PM
before i rewrite what's out there does anyone know of any opensource or free code that takes a mysql query and creates a sortable html table

03-01-2007, 03:19 PM
It really depends on what you want. If you want the table sortable in the client, then yeah, there are lots of javascript libraries that will do what you want.

http://kryogenix.org/code/browser/sorttable/ (first hit on google)

However, if you want to write a sortable table sorted by an HTTP request to PHP, then chances are you should write your own. Tables are all so different and the components doing the sorting could be PHP or SQL (Depending upon speed requirements). Additionally, if you have pagination, uh, well, you should probably write your own anyway.

03-01-2007, 04:21 PM
It's possible to write a general purpose table generator. I have one and it is quite a useful tool. Like mentioned, you can add automatic pagination, and checkboxes for when the user needs to select 1 or multiple rows.

Just remember to keep markup out of the generator. Use CSS to markup the table (give a generic class to the table itself, the rest you can do with selectors).