Since the sort order is a client preference, I would imagine you could
stash the client's preferred order in a cookie and use that for return
visits. Otherwise, each visitor could override the previous visitor's
preference, and you're no further ahead.
Take a look at the LivePipe Cookie ext
My table columns are sorted by the Tablekit library (millstream.com.au/
upload/code/tablekit/) which run on Prototype.
The user can click the columns to toggle the sort order either
ascendingly or descendingly.
I can save the current sort order (preference) in the server.
After the page is refreshe