Re: Sortable tables

Orion Adrian schreef:
>> There is nothing to stop browser manufacturers implementing this today!
>> (and for HTML too)
> 
> Actually given the tight intergration of presentation and semantics in
> tables via colspan and rowspan this would be nearly impossible to do
> correctly all the time. Say someone had a table like so:
> 
> <table>
> <tr><td>A<td>B<td>C<td>D</tr>
> <tr><td>1200<td>1600<td>1900<td>400</tr>
> <tr><td>$1,200<td colspan=3>N/A</tr>
> </table>

Aside from that the headings are not marked up as such, I don’t see a 
direct problem here for sorting (although there is one for column 
reordering). There is a slight problem with rowspans though.

I see two ways to sort tables with rowspans:
1. For the purpose of sorting, the cells with a rowspan could just be 
‘expanded’ to n separate cells. When they end up next to eachother 
again, they can be re-combined.
2. The sorting can consider the rowspanned cells to be ‘grouped’. That 
means the rows those cells are in are only moved as a whole. The values 
inside the group are also sorted. Like ‘group by’ in SQL.

I think solution 2 is the best one.

I am the first to admit that rowspan and colspan aren’t the easiest to 
deal with when considering sorting capabilities, but I do think they 
convey important, structural/semantic information. To say that they are 
making things ‘nearly impossible’ is not true at all. The sorting just 
needs to be done more intelligently compared to ‘plain vanilla’ tables 
without column/row spanning.

So, please do not claim things that are clearly untrue.


~Grauw

-- 
Ushiko-san! Kimi wa doushite, Ushiko-san nan da!!

Received on Tuesday, 30 August 2005 13:30:08 UTC