%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1655899072" format="1.1" version="1"}%
%META:TOPICPARENT{name="Macros"}%
---+ TABLE -- control attributes of tables and sorting of table columns
The =%<nop>TABLE{}%= macro is handled by the TablePlugin
%STARTSECTION{"table_attributes"}%
---++++ Attributes for tables
%TABLE{tablewidth="100%" columnwidths="10%,45%,20%,25%" sort="off"}%
     | *Parameter*         | *Description*  | *Default*  | *Example*  |
     | =tableborder=      | Table border width (pixels). | ="1"= | =tableborder="2"= |
     | =tablebordercolor= | Table border color. | <span class="foswikiGrayText">unspecified</span> | =tablebordercolor="#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). | <span class="foswikiGrayText">unspecified</span> | =tableframe="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=. | <span class="foswikiGrayText">unspecified</span>  | =tablerules="rows"= |
     | =tablewidth=       | Table width: percentage of window width, or absolute pixel value. | <span class="foswikiGrayText">unspecified</span>  | =tablewidth="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. | <span class="foswikiGrayText">unspecified</span>; 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.| <span class="foswikiGrayText">unspecified</span> | =caption="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). | <span class="foswikiGrayText">unspecified</span> | =inlinemarkup="on"= |
     | =class=            | Add specified class to the default =foswikiTable= class. | <span class="foswikiGrayText">unspecified</span> | =class="mytable"= |

---++++ Attributes for table sorting
%TABLE{tablewidth="100%" columnwidths="10%,45%,20%,25%" sort="off"}%
     | *Parameter*       | *Description*  | *Default*  | *Example*  |
     | =sort=           | Set the table sorting user interface (clickable column headers) ="on"= or ="off"=. | <span class="foswikiGrayText">unspecified</span> | =sort="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. | <span class="foswikiGrayText">unspecified</span> | =initsort="2"= |
     | =initdirection=  | Initial sorting direction for =initsort=, set to  ="up"= (descending, or decreasing in value) or ="down"= (ascending, or increasing in value). | =down= | =initdirection="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. | <span class="foswikiGrayText">unspecified</span> | =disableallsort="on"= |

---++++ Attributes for table cells
%TABLE{tablewidth="100%" columnwidths="10%,45%,20%,25%" sort="off"}%
     | *Argument*       | *Description*  | *Default*  | *Example*  |
     | =cellpadding=    | Cell padding (pixels). | <span class="foswikiGrayText">unspecified</span> | =cellpadding="0"= |
     | =cellspacing=    | Cell spacing (pixels). | <span class="foswikiGrayText">unspecified</span> | =cellspacing="3"= |
     | =cellborder=     | Cell border width (pixels). | <span class="foswikiGrayText">unspecified</span> | =cellborder="0"= |
     | =valign=         | Vertical alignment of cells and headers, set to ="top"=, ="middle"=, ="bottom"= or ="baseline"=. | <span class="foswikiGrayText">unspecified</span>  | =valign="top"= |
     | =columnwidths=   | Column widths: Comma delimited list of column widths, percentage or absolute pixel value. | <span class="foswikiGrayText">unspecified</span>  | =columnwidths="80%,20%"= |

---++++ Attributes for data cells
%TABLE{tablewidth="100%" columnwidths="10%,45%,20%,25%" sort="off"}%
     | *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. | <span class="foswikiGrayText">unspecified</span>  | =datarules="none"= |
     | =datavalign=     | Vertical alignment of data cells; overrides =valign=. | <span class="foswikiGrayText">unspecified</span>  | =datavalign="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. | <span class="foswikiGrayText">unspecified</span>  | =dataalign="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 =databg= | =databgsorted="#d4e8e4, #e5f5ea"= |
     | =datacolor=      | Data cell text colour, a comma separated list. | <span class="foswikiGrayText">unspecified</span> | =datacolor="#00c, #000"= |

---++++ Attributes for headers
%TABLE{tablewidth="100%" columnwidths="10%,45%,20%,25%" sort="off"}%
     | *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. | <span class="foswikiGrayText">unspecified</span>  | =headerrules="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 =headerbg= | =headerbgsorted="#32596c"= |
     | =headercolor=    | Header cell text colour. | ="#fff"= | =headercolor="#00c"= |
     | =headervalign=   | Vertical alignment of header cells; overrides =valign=. | <span class="foswikiGrayText">unspecified</span>  | =headervalign="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. | <span class="foswikiGrayText">unspecified</span>  | =headeralign="left,right"= |
     | =headerrows=     | See: Attributes for tables |||

---++++ Other attributes
%TABLE{tablewidth="100%" columnwidths="10%,45%,20%,25%" sort="off"}%
     | *Parameter*       | *Description*  | *Default*  | *Example*  |
     | =include=        | Other topic defining the =TABLE= parameters. The first =%<nop>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. | <span class="foswikiGrayText">unspecified</span> | =include="%USERSWEB%.%HOMETOPIC%"= |

%ENDSECTION{"table_attributes"}%
---++ Examples
<verbatim class="tml">
 %TABLE{ sort="off" tableborder="0" cellpadding="4" cellspacing="3" cellborder="0" }%
 | *A1* | *B1* |
 | A2   | B2   |</verbatim>
   * Expands as: %TABLE{ sort="off" tableborder="0" cellpadding="4" cellspacing="3" cellborder="0" }%
 | *A1* | *B1* |
 | A2   | B2   |
%STOPINCLUDE%
---++ Related
 See TablePlugin for more details
