[whatwg] [html5] 2.20.1. The datagrid element

Ian Hickson ian at hixie.ch
Sun May 1 06:24:22 PDT 2005

On Fri, 29 Apr 2005, Anne van Kesteren wrote:
> Some initial comments on possible problems I spotted.


> # Columns, rows, and cells can each have specific classes applied to
> # them by the data provider.
> Classes is nowhere defined. Is this about the HTML CLASS attribute? If 
> so, could that be more clearly stated. If otherwise, could it be 
> elaborated for a bit to make it more understandable.

Tried to elaborate.

> # getRowCount(): The number of rows returned by the default data
> # provider must be the number of tr elements that are children of tbody
> # elements that are children of the table, if there are any tbody
> # elements. If there are no tbody elements then the number of rows
> # returned must be the number of tr  elements that are children of the
> # table.
> What happens here:
>  <table>
>   <xhtmlfoo:content>
>    <tr>
>     ...
> ... should it return 0? Or should it look for all descendents of TABLE
> when there is neither a TBODY or TR child element.

It returns 0, because the table contains neither tbody nor tr children.

> # getColumnCount(): If the table has a thead element child, and the
> # first such element has a tr element child, then the number of columns
> # returned by the default data provider must be the number of th
> # element children in the first such tr  element, if there are any such
> # th elements.
> This 'messes up' perfectly valid tables like:
>  <table>
>   <thead>
>    <tr>
>     <th colspan="2">Male
>     <th colspan="2">Female
>    <tr>
>     <th>Alcoholic
>     <th>Suicidel
>     ...
> ... no?

As the spec says:
   The colspan and rowspan attributes are ignored by this algorithm.

Datagrids in common GUIs aren't capable of complex column captions like 
the above. How would you change the spec to work with the above?

> # getCaptionText(i): If the table has no thead element child, or if its
> # first thead  element child has no tr element child, the default data
> # provider must return the empty string for all captions. Otherwise,
> # the value of the textContent  attribute of the ith th element child
> # of the first tr element child of the first thead element child of the
> # table element must be returned. If there is no such th element, the
> # empty string must be returned.
> How about trying to select the value of the CAPTION element[1] first?
> The same might apply to getCaptionClasses(i, classes).

The caption element gives the table's caption, not a column's caption.

> By the way, it would make more sense to say:
>  <datagrid sortable="">
> ... and that it then applies to all columns.

Yeah, this is one of the things I was wondering about. The problem there 
is that it would only make sense for one of the cases, not the others.

As a compromise I've made the spec look at the class attribute of the 
<table> element and if that says sortable, use that.

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