2 replies [Last post]
joeplanet
Offline
newbie
San Antonio, TX
Last seen: 16 years 20 weeks ago
San Antonio, TX
Timezone: GMT-5
Joined: 2003-06-26
Posts: 1
Points: 0

I would like to be able to use class selectors in TH tags to indicate different states of sortability in a table (actively sorted ascending, actively sorted descending, etc...think about how MS Outlook sorts email). I want to use a class that not only styles the look of the cell but uses/attaches a background image for the arrow icon (up, down, grayed out, etc) BUT HERE IS THE CATCH: the image must appear to the right of the text in the cell and there is no way of knowing in advance the number of characters in the cell. Also, sometimes the column is quite a lot wider than the text, so there can be ample room on either side of the table header text. As a minor point, the user will be able to click the cell to sort by that column.

Before anyone expounds upon the archaic use of tables, I do not have a choice with reworking the current framework about which I describe.

This is a noodle scratcher to be sure and all help will be most appreciated.

joeplanet
San Antonio, TX

dJomp
dJomp's picture
Offline
Enthusiast
Last seen: 3 years 41 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

Classing TH elements and indicating sortability

If you want it after the text, it'd have to be done in whatever scripting language you're using. It should be possbile to right-align a background image in a cell, if you don't mind it being in the far-right of the cell...

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.

Sven
Sven's picture
Offline
Enthusiast
Brisbane, Australia
Last seen: 12 years 23 weeks ago
Brisbane, Australia
Timezone: GMT+10
Joined: 2003-03-12
Posts: 166
Points: 0

Classing TH elements and indicating sortability

Agreed, you could just use something like:

td.sortedAscending { background:url("up_arrow.gif") top right; }

If the background image needs to be spaced out a little from the edge, the image itself could be enlarged...