You are here: Foswiki>Tasks Web>Item3198 (12 Sep 2009, ArthurClemens)Edit Attach

Item3198: Incorrect formatting of table headers

pencil
Priority: Enhancement
Current State: Closed
Released In:
Target Release: n/a
Applies To: Extension
Component: TablePlugin
Branches:
Reported By: TWiki:Main.ThomasWeigert
Waiting For:
Last Change By: ArthurClemens
When there is no space between the * and the header text then if the header contains a link, it is not formatted as a link, and the web is shown. Witness:

Table 1

%TABLE{headerrows="1" sort="off"}%
|*A*|*TWiki.StandardColors*|
|1|yellow|
|2|red|
|3|green|
|4|white|

A StandardColors
1 yellow
2 red
3 green
4 white

Table 2: With the sorting allowed, the header is not bold faced.

%TABLE{headerrows="1"}%
|*A*|*TWiki.StandardColors*|
|1|yellow|
|2|red|
|3|green|
|4|white|

A StandardColors
1 yellow
2 red
3 green
4 white

Table 3: Same issue as (2) for a table without the table plugin directive

|*A*|*TWiki.StandardColors*|
|1|yellow|
|2|red|
|3|green|
|4|white|

A StandardColors
1 yellow
2 red
3 green
4 white

Note that if you leave spaces, the links become links, but then you have another bug, see Item3197.

Table 4: If you don't have the *, you do not get header cells, but you get the link.

|*A*|TWiki.StandardColors|
|1|yellow|
|2|red|
|3|green|
|4|white|

A StandardColors
1 yellow
2 red
3 green
4 white


Maybe its because of my flu, but I don't understand the point being made. Could you write up a problem summary? AC

Problem Summary

Suddenly, formatting of header cells in tables does not work as it did in the past. I believe the requirements are that
  • A table row where all cells are bolded (surrounded by *) is a "header" row (albeit that row may be inside the table or the footer also)
  • A "header" row is shown with bold font and with a "header background"
  • If the table is sortable, the top header row only has links to allow sorting.

As we can see from above, the following deviations from this exist:
  1. Links in "header" rows are not properly formatted as they show the web. See Table 1-3.
  2. If a table is not sortable, a link to a topic in the "header" row is not a link. See Table 1.
  3. If a table is sortable, the "header row" is not shown in bold font (see Table 2 and Table 3)

TW
This happens in a twiki form, not in a twiki topic, because of this style:
.twikiFormTable th {
   font-weight:normal;
}

I have changed this.

AC
Problem 1 and 2 still persist. See above. -- TW
Problem 1: you are using a table header that happens to look like a web.topic link. If you prefer to disambigue the syntax, use bracket notation:

%TABLE{headerrows="1" sort="off"}%
|*A*|*[[TWiki.StandardColors]]*|
|1|yellow|
|2|red|
|3|green|
|4|white|

A TWiki.StandardColors
1 yellow
2 red
3 green
4 white

Pass a header color parameter to make the link readable:

A TWiki.StandardColors
1 yellow
2 red
3 green
4 white

Oops. That looks like a different bug.

Problem 2: the header is now bold (it wasn't before my fix). Try empty your cache first if the problem persists.

AC
Problem 1 still persists. It should not be required to put brackets around a TWiki word to make it appear as a link and format correctly. TWiki.TWikiTemplates should appear as TWikiTemplates, everywhere where TML is expanded.

Problem 2 still persists. Table 1 should have a clickable link in the header cell.

TW

You are saying that with the notation of TWiki.StandardColors (so even StandardColors in TWiki web), TablePlugin must recognize this as a link to a topic and should not use this link as a sortable header.

How would that work?

AC
No.

What I am saying is

1. In a WikiWord, the formatting is so that the web is not shown. E.g. TWiki.TWikiTemplates renders as TWikiTemplates. That should be true in table headers also.

2. If a table is not sortable, a WikiWord in the header should function as a link (as it is not overridden by the TablePlugin sort functionality).

TW

For a non-sortable column the solution is easy. TablePlugin wraps the header text inside **, and that has the same effect as on a topic page: TWiki.StandardColors.

I've changed the syntax from *Header* to <strong> Header </strong> to make links possible.

But for sortable columns the situation is not so easy. The header text is wrapped inside <a></a>. That is before the header name is recognized as a topic name (or web.topic name). If I put spaces around the header text, this is always rendered as a link to a topic instead of a column sort link.

AC

Apparently has been solved.

-- ArthurClemens - 12 Sep 2009

ItemTemplate edit

Summary Incorrect formatting of table headers
ReportedBy TWiki:Main.ThomasWeigert
Codebase
SVN Range TWiki-4.1, Sat, 18 Nov 2006, build 12001
AppliesTo Extension
Component TablePlugin
Priority Enhancement
CurrentState Closed
WaitingFor
Checkins 12061 12102
TargetRelease n/a
ReleasedIn
Topic revision: r19 - 12 Sep 2009, 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