N-Bomb(Nerd) Posted December 1, 2009 Share Posted December 1, 2009 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 More sharing options...
trq Posted December 1, 2009 Share Posted December 1, 2009 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 More sharing options...
N-Bomb(Nerd) Posted December 1, 2009 Author Share Posted December 1, 2009 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 More sharing options...
trq Posted December 1, 2009 Share Posted December 1, 2009 Not if your using a correct data type. Link to comment https://forums.phpfreaks.com/topic/183540-sorting-table/#findComment-968771 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.