1

Topic: Sorting results pages

Has anyone come up with code to turn the table column titles into "sort by" links.

My idea is to be able to click on "Name" at the top and have the table sort by that or "id" and have it sort by the number.

I have changed the code on my configuration so the default sorting is to sort by the id#, it is "id +0" if anyone wants to do that. This sorts the numbers ascending 1,2,3,4... etc a simple sort by "id" gives you 1,10,100, etc so the +0 fixes that.

Figured I would ask if anyone has done it before I go trying to re-invent the wheel

:-)

2

Re: Sorting results pages

I assume you are trying to have an additional way of sorting (clicking column titles). Is the pull-down menu for sorting (which also provides for double sorting, first, say, by name, and then, say, by owner) inadequate? :)

PS: The pull-down menus (http://stanxterm.aecom.yu.edu/secondary/stocks/images/proteins-front.jpg) may not be shown if all result rows fit on one page.

3

Re: Sorting results pages

no the pull down menus dont display because it all fits on a page (well i made it all fit because i did not want it to pagenate the results, but I still want the sorting option... is there a way to make the pull downs always display?

thanks

J

4

Re: Sorting results pages

Edit file 'top_part.php'. There is an 'if' conditional code block; edit to remove the 'if(...)' and the opening & closing curly brackets. The long block looks like this:

///////////////////////////////////////////////////////////////////////////
// build menu form for resorting; the option values are table column headings
 // only if more than one page of data
if ($total_pages>1)
{
...
}
// end - build sort form
///////////////////////////////////////////////////////////////////////////