Sorting a table on a page

User 1871531 Photo


Registered User
49 posts

The following page has three columns on the right side:

http://www.chisagocountyhistory.org/tes … eries.html

I would like to add "Sort" buttons at the top of the columns that when clicked would resort the table.

My initial thought is to create jpg overlays that would be painted into this area, depending on which button was clicked. But I think the hyperlinks in the first column are a problem in that method. My next thought was to create 3 identical pages but with a different sort on each page, then call the appropriate page when clicking a button.

Is there a better way? What method(s) would you suggest to accomplish this?
User 187934 Photo


Senior Advisor
20,271 posts

There's a lot of ways to do this but I think this would be the easiest.:)
http://progrower.coffeecup.com/iframeswitch.html
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 1871531 Photo


Registered User
49 posts

Okay, great! I understand how that will work. I did forge ahead with swapping full pages. I will give the "Frames" concept a try next. I have some other pages where I can use this concept as well.

Thank you for the prompt response and the link to your examples!
User 187934 Photo


Senior Advisor
20,271 posts

The iframe gives a lot of flexibility because you can easily edit the single pages.
But here's some more options.:)
I also found this great example of actually using tables, what they were meant for.
http://www.kryogenix.org/code/browser/sorttable/

I also have this javascript example for showing and hiding data.
http://progrower.coffeecup.com/showhide.html
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 464893 Photo


Ambassador
1,611 posts

Thanks for that link Eric. I will definitely add that to my box of tricks. You are no slouch either with the code you portray.
The Guy from OZ


User 38401 Photo


Senior Advisor
10,951 posts

Try googling for some scripts for this too, there are definitely some out there that you can use for sorting columns. Not sure if it works for tables or not, but I know I've found some over the years.
User 464893 Photo


Ambassador
1,611 posts

You are right Jo I looked at some Javascript that will add, average and do any math on values if set up correctly. Do what Jo has advised you will find a function to do what you want
The Guy from OZ



Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.