Jump to content

Sorting Table


N-Bomb(Nerd)

Recommended Posts

I have a dynamically created table that populates from a database, however I'm wanting to the user to be able to sort the columns by their choice. What is the standard way of going about this?

 

I'm wanting them to be able to sort any column they want; having it be either ascending or descending.

Link to comment
https://forums.phpfreaks.com/topic/183540-sorting-table/
Share on other sites

I would firstly be inclined to do this client side if possible, if they don't have js enabled of course you would need the ability to have it sorted server-side. jQuery has a tone of plugins that sort tables.

 

Anyway, as for sort server side. You would simply have your headings link a sortby peram back to your querying script. eg; ?sortby=name&order=desc

Link to comment
https://forums.phpfreaks.com/topic/183540-sorting-table/#findComment-968754
Share on other sites

I'm trying to figure out how to have it sorted server-side first.. something comes to mind.

 

Dates - How would sorting dates work? For example the current format I'm using is "November 30, 2009, 3:59 pm". I would assume if you try to sort dates like that cover the course of lets say two years.. is is going to just sort based off the month and not take into consideration the year?

Link to comment
https://forums.phpfreaks.com/topic/183540-sorting-table/#findComment-968770
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.