TABLE -- control attributes of tables and sorting of table columns

The %TABLE{}% macro is handled by the TablePlugin

Attributes for tables

Parameter Description Default Example
tableborder Table border width (pixels). "1"tableborder="2"
tablebordercolor Table border color. unspecifiedtablebordercolor="#333"
tableframe Table frame, set to "void" (no sides), "above" (the top side only), "below" (the bottom side only), "hsides" (the top and bottom sides only), "lhs" (the left-hand side only), "rhs" (the right-hand side only), "vsides" (the right and left sides only), "box" (all four sides), "border" (all four sides). unspecifiedtableframe="hsides"
tablerules Table rules, set to "none" (no rules), "groups" (rules will appear between row groups and column groups only), "rows" (rules will appear between rows only), "cols" (rules will appear between columns only), "all" (rules will appear between all rows and columns). See also: headerrules and datarules. unspecifiedtablerules="rows"
tablewidth Table width: percentage of window width, or absolute pixel value. unspecifiedtablewidth="100%"
headerrows Number of header rows to exclude from sort. (will be rendered in a HTML thead section) "1"headerrows="1"
footerrows Number of footer rows to exclude from sort. (will be rendered in a HTML tfoot section) "0"footerrows="1"
id Unique table identifier string, used for targeting a table with CSS. tableN (where N is the table order number on the page) id="userTable"
summary Table summary used by screen readers: A summary of what the table presents. It should provide an orientation for someone who listens to the table. unspecified; WARNING: this attribute is deprecated in HTML5, don't use it anymore. summary="List of subscribed users"
caption Table caption: A title that will be displayed just above the table. unspecifiedcaption="Users"
inlinemarkup Set to "on" to generate inline markup HTML (in addition to the CSS markup); useful if you need to copy the table, for instance to paste the table into an email). unspecifiedinlinemarkup="on"
class Add specified class to the default foswikiTable class. unspecifiedclass="mytable"

Attributes for table sorting

Parameter Description Default Example
sort Set the table sorting user interface (clickable column headers) "on" or "off". unspecifiedsort="on"
initsort Column to sort initially (use "1" for the first column). If specified, sorting is enabled; by setting sort="off" the sorting interface can be hidden. unspecifiedinitsort="2"
initdirection Initial sorting direction for initsort, set to "up" (descending, or decreasing in value) or "down" (ascending, or increasing in value). downinitdirection="up"
disableallsort Disable all sorting, both initsort and header sort. This is mainly used by plugins such as the EditTablePlugin to disable sorting in a table while editing the table. unspecifieddisableallsort="on"

Attributes for table cells

Argument Description Default Example
cellpadding Cell padding (pixels). unspecifiedcellpadding="0"
cellspacing Cell spacing (pixels). unspecifiedcellspacing="3"
cellborder Cell border width (pixels). unspecifiedcellborder="0"
valign Vertical alignment of cells and headers, set to "top", "middle", "bottom" or "baseline". unspecifiedvalign="top"
columnwidths Column widths: Comma delimited list of column widths, percentage or absolute pixel value. unspecifiedcolumnwidths="80%,20%"

Attributes for data cells

Parameter Description Default Example
datarules Set to "none" (no rules), "rows" (rules will appear between rows only), "cols" (rules will appear between columns only), "all" (rules will appear between all rows and columns). Overrides tablerules for data cells. unspecifieddatarules="none"
datavalign Vertical alignment of data cells; overrides valign. unspecifieddatavalign="top"
dataalign Data cell alignment, one value for all columns, or a comma separated list for different alignment of individual columns. Set to "left", "center", "right" or "justify". Overrides individual cell settings. unspecifieddataalign="center"
databg Data cell background colour, a comma separated list. Specify "none" for no colour, that is to use the colour/background of the page the table is on. "#edf4f9,#fff"databg="#f2f2f2,#fff"
databgsorted Data cell background colour of a sorted column; see databg. the values of databgdatabgsorted="#d4e8e4, #e5f5ea"
datacolor Data cell text colour, a comma separated list. unspecifieddatacolor="#00c, #000"

Attributes for headers

Parameter Description Default Example
headerrules Set to "none" (no rules), "rows" (rules will appear between rows only), "cols" (rules will appear between columns only), "all" (rules will appear between all rows and columns). Overrides tablerules for header cells. unspecifiedheaderrules="none"
headerbg Header cell background colour. Specify "none" for no colour, that is to use the colour/background of the page the table is on. "#6b7f93"headerbg="#999"
headerbgsorted Header cell background colour of a sorted column. Specify "none" for no colour, that is to use the colour/background of the page the table is on. the value of headerbgheaderbgsorted="#32596c"
headercolor Header cell text colour. "#fff"headercolor="#00c"
headervalign Vertical alignment of header cells; overrides valign. unspecifiedheadervalign="top"
headeralign Header cell alignment, one value for all columns, or a comma separated list for different alignment of individual columns. Set to "left", "center", "right" or "justify". Overrides individual cell settings. unspecifiedheaderalign="left,right"
headerrows See: Attributes for tables

Other attributes

Parameter Description Default Example
include Other topic defining the TABLE parameters. The first %TABLE% in the topic is used. This is useful if you have many topics with the same table format and you want to update the format in one place. Use topic or web.topic notation. unspecifiedinclude="Main.WebHome"

Examples

 %TABLE{ sort="off" tableborder="0" cellpadding="4" cellspacing="3" cellborder="0" }%
 | *A1* | *B1* |
 | A2   | B2   |
  • Expands as:
    A1 B1
    A2 B2

See TablePlugin for more details

Topic revision: r1 - 2024-12-23, UnknownUser

This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback