Forum Moderators: open

Message Too Old, No Replies

Firefox table printing problems

Documenting some problems found when printing long complicated tables in FF

         

simonwheatley

3:11 pm on Jun 17, 2005 (gmt 0)

10+ Year Member



I am concerned that I may have found a bug in table printing on Firefox on Windows (v 1.0.4). I wanted to run it past the list to check that I'm not doing anything stupid.

<SNIP>

Basically it is a table with a thead element and repeated tbody elements. Each tbody element starts with a tr containing just one th, which colspans the whole table width.

If I remove all the tbody elements, replacing them with one tbody that envelopes everything not in the thead, it prints fine. However this seems to me to destroy the semantics of the table.

Is this use of tables valid and, secondarily, semantic?
Any other suggestions to make sure this prints?

NB: This has been cross-posted to the WD-L mailing list, but as my email hasn't appeared after 4.5 hours I decided to post here as well. Hope this doesn't work out too annoying.

[edited by: BlobFisk at 3:14 pm (utc) on June 17, 2005]
[edit reason] No URLs please! See TOS [webmasterworld.com] [/edit]

simonwheatley

3:13 pm on Jun 17, 2005 (gmt 0)

10+ Year Member



I forgot to state the problem. Doh.

When printed from Firefox v1.0.4 on Windows, the table gets cut short at one page, i.e. any rows after the first page are silently dropped and not printed.

garann

8:24 pm on Jun 17, 2005 (gmt 0)

10+ Year Member



I think you might be misusing the elements of your table.

In most cases, you'd want one <thead> and one <tbody>. The <thead> should contain <tr>s with all your <th>s. The <tbody>'s <tr>s should contain <td>s.

Some browsers have special default behaviors for <th>s, and it's possible that what you're seeing is the browser finding and printing what it thinks are column headings, but not finding any content cells in those columns to "push" the table onto the next page and so ending the table.

simonwheatley

9:22 am on Jun 18, 2005 (gmt 0)

10+ Year Member



According to the w3c, you are allowed multiple TBODY elements within one table... see the spec here and specifically the example given, which is a table with 2 TBODY elements:
[w3.org...]

Using the TBODY multiple times allows you to create "rowgroups". You can then apply TH elements to a rowgroup by having it within the rowgroup, and using the attribute "scope='rowgroup'".

So, my link having been edited to help prevent forum spam [webmasterworld.com] (sorry) here is a simplified version of the table I'm having a problem with:

<table>
<thead>
<tr>
<th>Item</th>
<th>Qty</th>
</tr>
</thead>
<!-- start repeat -->
<tbody>
<tr>
<th colspan="2" scope="rowgroup">Order X, from Customer Y, placed on 16th September</th>
</tr>
<tr>
<th scope="row">An Item</th>
<td>10</td>
</tr>
<tr>
<th scope="row">An Item</th>
<td>5</td>
</tr>
</tbody>
<!-- end repeat -->
</table>