Re: Sortable tables

On 8/30/05, Laurens Holst <lholst@students.cs.uu.nl> wrote:
> 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.

My example was the wrong example, but column reordering is also a
problem. Especially with sorting since it is often useful to reorder
columns after a sort to put the primary sort key as the first column.

The question is can you produce an algorithm that can intelligently
determine between 1 and 2 above? There will always be situation now
where 1 or 2 is the wrong approach. I have yet to find a method that
clearly indicates where one is a better solution in any given
situation.

-- 

Orion Adrian

Received on Tuesday, 30 August 2005 13:36:33 UTC