W3C home > Mailing lists > Public > public-html@w3.org > April 2007

Re: <table type="rowsortable">

From: Bruce Boughton <bruce@bruceboughton.me.uk>
Date: Wed, 04 Apr 2007 22:36:22 +0100
Message-ID: <46141A56.4060609@bruceboughton.me.uk>
To: public-html@w3.org
CC: nene@triin.net
nene@triin.net wrote:
> David Dailey wrote:
>   
>> Desired: <table type="rowSortable">
>> Description: Whenever a user clicks on the top (head) of a column, the
>> rows of the associated tbody become re-ordered according to the data type
>> of that column.
>> [---]
>> (we may sort alphabetically by "from" or "subject" or chronologically
>> by "date").
>>     
>
> Sorting is a complex problem...
>   
<snip>
> I'd say it's a task too hard to give to the browsers, that can't
> even get right the "trivial" task of rendering appropriate quotes
> around <q> elements.
>
> Rene Saarsoo
>   
Sorting is indeed a complicated task.  However, it may not be necessary 
for the UA to do the sorting.  Perhaps we could use the UA to perform 
the UI related tasks, such as detecting clicks on the column headings, 
but delegate the sorting to a custom JavaScript function.  This would be 
similar to the Comparable interface in Java.  The UA could provide a 
default sorting implementation which does basic alphabetical sorting. 

This could be implemented using events.  We could define a onsort event 
for datagrid elements. When a user specifies a JavaScript function to 
perform the sort, it would be called for each subsequent pair of rows 
and asked to return which should come first. It would be told whether 
the sort was a forward or reverse sort. 

So, while it may be beyond the scope of the UA to provide decent sorting 
for every conceivable data type, it *may* not be beyond the scope of 
HTML to define a protocol for delegating this sorting to a client side 
script.

Bruce Boughton
Received on Wednesday, 4 April 2007 21:36:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:15:52 GMT