![]() Topic awaiting preservation: Table sorting with DOM (Page 1 of 1) |
|
---|---|
Bipolar (III) Inmate From: London, UK |
![]() 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 |
![]() 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 |
![]() nice work. |
Maniac (V) Mad Scientist From: New California |
![]() 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 |
![]() 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 |
![]() 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 |
![]() 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 |
![]() Quite right about that, Slime ... how about this version? http://stinx.no-ip.org/~rob/table_sort2.htm |