You are here: Foswiki>Tasks Web>Item5865 (12 Nov 2010, ArthurClemens)Edit Attach

Item5865: TablePlugin should support rowspan from header row

pencil
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: TablePlugin
Branches:
Reported By: TWiki:Main.VickiBrown
Waiting For:
Last Change By: ArthurClemens
The following code
| *A* | *B* | *C* | *D* | 
| ^ | One One | One Two | One Three |
| ^ | Two One | ^ | Two Three | 
| ^ | Three One | Three Two | ^ | 

should provide this result (screenshot )

TablePluginspans.jpg

and works as expected (matches screenshot) twiki.org.

It doesn't work as expected at develop.twiki.org. (It also fails at my Company, where I am trying to understand why!)

A B C D
One One One Two One Three
Two One Two Three
Three One Three Two

-- TWiki:Main/VickiBrown - 01 Aug 2008

Vicki - TWiki.org runs 4.1.1 - what are you running?

I'm suspicious that it might not be TablePlugin, rather the core doing something different. - I'm afraid we should contemplate the Urgency of this issue :/ Kicking it up to let Kenneth know (though given the timing, defering to 4.2.2 is likely)

-- TWiki:Main.SvenDowideit - 02 Aug 2008

We're running 4.0.5 with various plugins updated at Work (where this fails).

It succeeds (works as expected) on two personal sites that are running, respectively, 4.1.1 and 4.1.2.

-- TWiki:Main.VickiBrown - 04 Aug 2008

note. The failure of the spans is essentially cosmetic.

What's nasty is that the columns appear to be shifted left so the data is offset. (cell s One One, Two One, and Three One should be in column B but they appear to be in column A . Column D appears to be empty.)

-- TWiki:Main.VickiBrown - 11 Aug 2008

Anyone come up with a fix yet? Or a reason for the failure? Something I can test?

-- TWiki:Main.VickiBrown - 17 Aug 2008

New data. A span into a footer row also fails.

A user mistakenly used this format:
%TABLE{ headerrows="1" footerrows="1"}% 
| *A* | *B* | *C* | *D* |
| New | One One | One Two | One Three |
| ^ | Two One | ^ | Two Three |
| Old | Three One | Three Two | ^ |
| ^ | Four One | Four Two | Four Three |

A B C D
Four One Four Two Four Three
New One One One Two One Three
Two One Two Three
Old Three One Three Two

-- TWiki:Main.VickiBrown - 03 Sep 2008

Anyone volunteering to fix this for 4.2.4?

Otherwise I will not let is block a 4.2.4 release.

-- TWiki:Main.KennethLavrsen - 18 Sep 2008

One interesting observation: If you sort the tables by clicking on a column header, the redrawn parts are formatted correctly w.r.t. the table structure (empty cells of a span get filled, though, which might not be desired). In the lower table, the fixed footer row keeps its wrong format.

-- TWiki:Main.MarkusUeberall - 29 Sep 2008

Sopan has checked in a fix to TWiki. However the fix appears to be the removal of thead and tbody tags, which is probably not a long term solution.

See TWikibug:Item5865

-- CrawfordCurrie - 24 Nov 2008

I would not recommend this shortterm fix.

-- ArthurClemens - 24 Nov 2008

After looking at the problem and trying to find a solution, it appears that rowspans are not rendered across the thead block using contemporary browsers. Because the table gets a thead tag, rowspan does not work.

And because the tags thead, tbody and tfoot are not widely used, not implemented by all browsers, and only have a function with large tables where the header should be repeated, I would suggest:
  1. make the thead an optional attribute to TABLE
    • proposed syntax: usethead="on"
  2. by default render without these tags

-- ArthurClemens - 13 Dec 2008

What good do these thead and tbody and tfoot tags do? Is it only to be able to css style them?

On the NerdoMeter a usethead option is scoring pretty high. 95% of users will not understand it. 90% will probably think it is something else.

Then it may be better just to remove it and live without.

-- KennethLavrsen - 13 Dec 2008

It's mainly for printing purposes. When you have thead, tbody and tfoot, these headers will continue onto the next page of the table.

http://www.w3.org/TR/html4/struct/tables.html#h-11.2.3

Very useful when you have a huge table that spans over multiple pages.

-- KwangErnLiew - 13 Dec 2008

Yes, they are high on the nerdometer, and only would be added as param to TABLE when the user knows about thead (and knows that TABLE has this option). Expert setting.

-- ArthurClemens - 13 Dec 2008

So I just learned something new.

But how would we add an expert setting to the TABLE tag? We cannot really hide it. Maybe it needs to be described with a name and description that relates to what it does more than to what HTML tags it adds.

something with Span Header Over Multiple Page. And option multipageheader = "on".

That would move it a couple of steps down the NerdoMeter. The docu can then explain that multiplageheader prevents the header cells from spanning multiple rows in a small note.

-- KennethLavrsen - 13 Dec 2008

I agree, that is a better wording.

Downgrading to normal

The rowspan attribute on <th> cells within a <thead> element seems to work fine with plain HTML:

Categories Type 1
Type 1a Type 1b
Item 1 body row 1, cell 2 body row 1, cell 3

This is a pretty basic feature that is broken. Unless a longer term fix is forthcoming, I suggest that a short term fix be implemented.

-- IsaacLin - 23 Apr 2009

Looking more closely at the markup, only the first header row is being picked up as part of the <thead> element:

The following TML

| *Categories* | *Type 1* ||
| ^ | *Type 1a* | *Type 1b* |
| Item 1 | body row 1, cell 2 | body row 1, cell 3 |

produces the following output:

Categories Type 1
Type 1a Type 1b
Item 1 body row 1, cell 2 body row 1, cell 3

Only the first row is being placed within the <thead> element.

Line 1629 in Foswiki::Plugins::TablePlugin::Core identifies a header row if the total number of header cells seen matches the column count. Header cells spanning multiple rows should be taken into account by this algorithm.

-- IsaacLin - 27 Apr 2009

Test using the headerrows parameter to %TABLE%:

Categories Type 1
Type 1a Type 1b
Item 1 body row 1, cell 2 body row 1, cell 3

I did not find any documentation for how the header (or footer) rows are auto-detected without the headerrows (or footerrows) parameter; can someone shed some light on the intended behaviour? Although TablePlugin says that the number of rows listed in the headerrows parameter will be placed in a <thead> element, this does not appear to be the case.

-- IsaacLin - 30 Apr 2009

It's not totally clear to me either, because it is a bit overcomplicated. Because table plugin has a default header row count of 1 (see init). If you set that default to 0 you run into troubles. This is regardless of the param headerrows.

Then each row that has all cells with bold tags (stars) is counted as a header row.

Each header row is placed inside thead.

Below thead, each footer row is defined the same, but only if param footerrows is set.

According to specs, a rowspan should work across a thead into the tbody, but I don't believe every browser does it right.

-- ArthurClemens - 30 Apr 2009

Though I can't find anything specific in the HTML 4.01 spec regarding a cell that spans the thead and tbody elements, it is a problematic case, because it results in a conflict when rendering the table for printing. Should the cell be only partially rendered within the header that is repeated on each page?

Looking at the draft HTML 5 spec, cells cannot belong to more than one row group, so a cell spanning both thead and tbody would not be well-formed in HTML 5. (http://dev.w3.org/html5/spec/Overview.html#table-model)

-- IsaacLin - 06 May 2009

So if we would "fix" (enhance) this, it would be invalid for html5. I think we need to live with this small shortcoming.

But rowspans inside thead should be possible: Item10016.

-- ArthurClemens - 12 Nov 2010

ItemTemplate edit

Summary TablePlugin should support rowspan from header row
ReportedBy TWiki:Main.VickiBrown
Codebase trunk
SVN Range TWiki-5.0.0, Sun, 27 Jul 2008, build 17148
AppliesTo Extension
Component TablePlugin
Priority Normal
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
I Attachment Action Size Date Who Comment
TablePluginspans.jpgjpg TablePluginspans.jpg manage 10 K 01 Aug 2008 - 19:49 VickiBrown screenshot of expected result
Topic revision: r25 - 12 Nov 2010, ArthurClemens
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy