W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2012

Re: [whatwg] Sortable Tables

From: Silvia Pfeiffer <silviapfeiffer1@gmail.com>
Date: Wed, 7 Nov 2012 09:18:42 +1100
Message-ID: <CAHp8n2mue9oZn=U8c7Opvx3iewvJGafT3UOEZKLuqHeJXs3B3g@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: whatwg@lists.whatwg.org
On Wed, Nov 7, 2012 at 6:55 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 11/6/12 11:39 AM, Ojan Vafai wrote:
>
>> This is a use-case that I absolutely think it makes sense to address.
>>
>
> Agreed.  Not that I can commit to implementing, necessarily, but I do
> think this is a common want.
>
>
Great to hear browser interest! It's something I've had to implement for
basically all Web apps I've been involved with developing, so am really
keen to get browsers to take this over.

Not quite new, but a good requirements analysis can be had from the list of
JS solutions here:
http://tympanus.net/codrops/2009/10/03/33-javascript-solutions-for-sorting-tables/

I our apps, we'd typically not associate sortable to the table, but to a
column header.
Typical classes/attributes we'd add to a table header cell:
* sortable class: boolean
* data-direction: ascending/descending
* data-type: date, number, text etc which determines the comparison
function used in sort
* data-sort-prio: numeric indicating sorting priority

Also, a sortable table's header needed some indication of the sortability,
so some default CSS like this:
    th.sortable {
      &:after { content: " ▲▼"}
      &.current{
        &[data-direction="asc"]:after { content: " ▼"}
        &[data-direction="desc"]:after { content: " ▲"}
      }
    }

HTH...

Cheers,
Silvia.
Received on Tuesday, 6 November 2012 22:19:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:11 GMT