I've recently been playing around with the <data:table> and related tags. I'm sure I've just scratched the surface as to all the capabilities, but so far am very impressed!
One thing I wasn't able to find is a way to place a <caption> tag inside a table. Is there any way to do so that I just didn't see, or are there any plans for this in the future?
As I was looking for more info, I found a bunch of other tags I didn't know about - they seem quite useful for controlling table design but I wasn't sure how you would go about using them with data:table.
<col>, <colgroup> - for specifying column widths, alignment, span
<thead>, <tbody>, <tfoot> - for delimiting which rows are the header/footer portion of the table - apparently gives special rendering/behaviour in some browsers, though not well supported
I wonder if a really easy way to "support" these would just be to take all non-<data:>-content within the <data:table> tag and place it just inside the opening <table> tag in the compiled template?
<data:table>
<!-- Put the next three rows immediately
inside <table> tag in compiled template -->
<caption>Some title</caption>
<col width="10%">
<col width="80%">
<data:column name="title">
<data:header>Title</data:header>
<data:cell>{$title}</data:cell>
</data:column>
...
</data:table>
I'm not sure this helps with thead/tbody/tfoot though.
Anyways, love the tag so far - the syntax seems quite intuitive and the "autogen" feature has been a huge time-saver for me!
----
Some references just in case the above mentioned tags are not familiar (as they weren't for me):
http://www.w3schools.com/tags/tag_caption.asp
http://www.w3schools.com/tags/tag_col.asp
http://www.w3schools.com/tags/tag_colgroup.asp
http://www.w3schools.com/tags/tag_thead.asp
http://www.w3schools.com/tags/tag_tbody.asp
http://www.w3schools.com/tags/tag_tfoot.asp
Logged In: YES
user_id=555352
Part of your request can be done simple by adding attributes
to the <data:column> specifications. You can do:
<data:table from="data">
<data:column name="foo" width="10%" />
<data:column name="bar" style="width: 80%;" />
</data:table>
The other tags are part of the w3 specification, but I have
yet to see browsers that implement them. Perhaps someone
can correct my perception on this?
Logged In: YES
user_id=604745
To my surprise :), it seems all of these elements *are*
supported on IE6 (though it doesn't understand all the
attributes). <thead>/<tbody>/<tfoot> seem to work in
Mozilla. I can't speak for the other browsers.
I realize you can add the 'width' attribute like you've shown,
but I was just looking ahead to XHTML-strict, where
the 'width' attribute is not allowed in <td> or <th> elements.
The only way to specify the widths for XHTML-strict tables is
with the <col>/<colgroup> or using CSS id/class for
<th>/<td>. I think. Anyways, since XHTML-strict support
doesn't seem to even exist in the browsers (yet?), then I
guess this is unimportant.
In the meantime I'll see if there is a simple way to let the
<caption>/<colgroup>/<col> elements 'fall through' so
someone could use them if they wanted to. I'll post here if I
find something.
Thanks!
Logged In: YES
user_id=993532
As far as I can tell, thead/tbody/tfoot are never
implemented visually in browsers by default - all they are
for is to wrap <tr>, <th> and <td> tags to provide a
semantic representation of the information captured by the
table (please correct me if I'm wrong on this)...
One of the potential uses is where a table stretches over
multiple pages of a print-out, and the thead is used to
repeat the same header data across each page.
It is possible to exploit thead/tfoot elements as 'hooks' to
achieve some interesting effects using CSS... for example,
pushing multiple overlapping background images into the
corners of the table to create a gradient dropshadow effect,
which can make an HTML document template look highly
professional - although I'm sure purists would question this
technique, as far as the use of empty thead and tfoot tags
goes...
There is a simpler use though, which again relates to visual
presentation:
From MS:
"Tables can also consist of headers, footers, captions, and
multiple tBody elements. Most browsers automatically add the
tBody tag to the HTML stream to create well-formed HTML."
"You can use tBody elements to format parts of a table. For
example, you can have multiple tBody elements in a table,
each with different colors or fonts."
http://msdn.microsoft.com/workshop/author/tables/buildtables.asp