[whatwg] Sortable Tables

Ian Hickson ian at hixie.ch
Tue Nov 6 11:25:21 PST 2012


On Thu, 1 Jul 2010, Christoph Päper wrote:
>
> It's a common task outside HTML to sort tables by one or more of its 
> columns.
> 
> There does seem interest among web content providers in making tables 
> client-side sortable since there are several Javascript solutions to do 
> just that, eg. <http://meta.wikimedia.org/wiki/Help:Sorting>, 
> <http://tablesorter.com/docs/>. From these we can learn what would be 
> needed from markup to help sorting algorithms. None of this must be 
> behaviorial, but descriptionary.
> 
> For starters, only rows inside ‘tbody’s shall be reordered. For now 
> columns don’t have to be reordered, ie. only vertical, no horizontal 
> sorting. Nevertheless the design should make it possible to add the 
> other direction later.
> 
> Not every table has content that makes sense to be sorted in a different 
> order. So sortable tables should be marked as such. Note that ‘col’ and 
> ‘colgroup’ elements are hardly supported.
> 
> Not every column has content that makes sense to be sorted in a 
> different order. So non-sortable columns inside sortable tables should 
> be marked as such.
> 
> There are different ways to sort, eg. numeric, temporal or alphabetic 
> and ascending or descending. Therefore columns should bear information 
> how they should be sorted, ie. what kind of content their cells have.
> 
> Several columns may be used for sorting by some kind of priority.
> 
> The original order must be restorable.
> 
> Cell content may not consist of the string that should be used verbatim 
> for sorting purposes, eg. leading articles or similar numbers with 
> different units (‘g’, ‘kg’, ‘t’ …). Cells should have an optional 
> attribute indicating their sort key. The ‘time’ element already provides 
> the necessary metadata features for temporal sorting – maybe there 
> should be more of such elements instead.
>
> There may be columns that shall remain stable, eg. rank numbers.

This is a very interesting idea.

Is this something browser vendors would be interested in implementing? I'm 
hesitant to add a feature for this (which could be somewhat involved) 
before having the definite interest of some browser implementors.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list