Forum Moderators: open

Message Too Old, No Replies

Theory of sorting tables

         

orion_rus

6:13 pm on Dec 22, 2004 (gmt 0)

10+ Year Member



Can anybody say me a different ways to sort a table. I see only one. Have an array and construct table. When i resort it, i should construct new container. Hide previous and show this one. May be anybody have better ways?

Bernard Marx

4:02 pm on Dec 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In IE, I believe you can sort tables with some kind of sort function. Not aware of any cross-browser functions, but..

I reckon it would be better to change the values (and attributes if necessary) of the table cells, rather than creating a new table. Creating new tables might lead to memory loss.

An array might make the process - and the sorting - easier. Again, it's not 100% necessary.

jollymcfats

6:03 pm on Dec 31, 2004 (gmt 0)

10+ Year Member



I'd probably look to re-ordering the table rows with DOM manipulation, swapping the nodes around to match the desired sort order.