Topic awaiting preservation: Table sorting with DOM |
|
---|---|
Author | Thread |
Bipolar (III) Inmate From: London, UK |
posted 12-11-2002 01:21
I put this together recently, and was wondering if anyone has an idea on how to improve it. http://stinx.no-ip.org/~rob/table_sort.htm (It's on the end of an adsl line, so don't be too surprised if the link fails) |
Maniac (V) Mad Scientist From: New California |
posted 12-11-2002 03:09
stinx, I didn't have time to look deep into the code but I can say that the capability you have there is *very* useful. I think it can be very useful for database outputs without having to reload everytime a new sorting order is needed. Great idea! |
Maniac (V) Mad Scientist From: the bigger bedroom |
posted 12-11-2002 03:20
nice work. |
Maniac (V) Mad Scientist From: New California |
posted 12-11-2002 08:59
I've got a suggestion, you should place an up or down arrow image next to the column header according to the sort order. That would sweeten it up a bit |
Bipolar (III) Inmate From: Amsterdam |
posted 12-11-2002 11:31
Looks neat indeed, this sort of script would be very powerful when implemented within a component(like Borland's TDataSetTableProducer). I must say I have encountered a script like this before, but unfortunately, I can't find the site . |
Bipolar (III) Inmate From: London, UK |
posted 12-11-2002 17:21
Thanks for the feedback. I probably won't get round to improving it until I need to, but the ideas are sound. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 12-11-2002 18:30
Hmm... it would probably be best to put the TD's into an array, and then use array.sort with a custom sorting function that compares the values of the cells. That way, you're letting the browser do the sorting (which is a lot faster). Then, afterwards, you have to loop through the array and rearrange the table cells to be in the new positions. I'm not sure how that would be done, but there's probably a way. |
Bipolar (III) Inmate From: London, UK |
posted 12-12-2002 10:55
Quite right about that, Slime ... how about this version? http://stinx.no-ip.org/~rob/table_sort2.htm |