# Re: Sortable tables

Date: Tue, 30 Aug 2005 13:58:02 -0400
Message-ID: <abd6c80105083010588ff692a@mail.gmail.com>

```
On 8/30/05, Laurens Holst <lholst@students.cs.uu.nl> wrote:
> >> 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.
> > 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.
> >
> A user agent can just pick one, it doesn't need to intelligently
> determine anything. Both solutions are reasonable. Maybe a UA can let
> the user pick his one, if it thinks providing such a choice gives more
> value to the product. When the sorting is implemented through
> JavaScript, the website author can determine which method he thinks fits
> his table best.

Question:

Is the shift from this:

A | B | C
------------
C1 | 2 | 3
C1 | 4 | 4
C4 | 5 | 6
C4 | 7 | 8

to:

------------
C1
B | C
-------
2 | 3
4 | 4
C4
B | C
-------
5 | 6
7 | 8

structural or presentational?

--