This is a documentation subpage for Template:Static row numbers. It may contain usage information, categories and other content that is not part of the original template page. |
The pages listed in this category are templates.
This page is part of OODA WIKI's administration and not part of the encyclopedia.
Further template category notes
This category contains pages in the template namespace. It should not be used to categorize articles or pages in other namespaces. To add a template to this category:
|
This category is an index of templates which use TemplateStyles. It is automatically populated by {{Uses TemplateStyles}}.
Template to automatically add an unsortable column of row numbers to tables. A possible note to add above a sortable table: Row numbers are static. Other columns are sortable. This allows ranking of any column.
Works with wikitable
, sortable
, and plain tables. Include this template before the table and add the class static-row-numbers
to the table wikitext.
{{Static row numbers}}
{| class="static-row-numbers"
These templates are helpful for non-header rows:
- {{Static row numbers no rank}} - No row number (rank number) on that row.
- {{Static row numbers total}} - No row number, and cell text/data is bolded. "Total" rows, for example.
- {{Static row numbers header}} - No row number, and cell text/data is center-aligned (as in header rows).
These templates are deprecated:
- {{Static row numbers table}} - Prevents sticky headers from working.
- {{Static row numbers arrows}} - There is no separate sort row when used with sticky headers.
Usage with wikitable
and sortable
|
{{Static row numbers}}
{| class="wikitable sortable static-row-numbers"
|-
! rowspan=2 | Name
! colspan=3 | Data columns
|-
! A !! B !! C
|-
| Red || 1|| 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|} |
Usage with wikitable
It requires at least one row of column headers. For multiple rows of headers, add class static-row-header
to the row wikitext to disable numbering and remove the shared border; not needed if only one row of headers.
|
{{Static row numbers}}
{| class="wikitable static-row-numbers"
|- class=static-row-header
! rowspan=2 | Name
! colspan=3 | Data columns
|- class=static-row-header
! A !! B !! C
|-
| Red || 1|| 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|} |
Usage with sortable
|
{{Static row numbers}}
{| class="sortable static-row-numbers"
|-
! rowspan=2 | Name
! colspan=3 | Data columns
|-
! A !! B !! C
|-
| Red || 1|| 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|} |
Usage with plain tables
It requires at least one row of column headers. For multiple rows of headers, add class static-row-header
to the row wikitext to disable numbering; not needed if only one row of headers.
|
{{Static row numbers}}
{| class="static-row-numbers"
|-
! rowspan=2 | Name
! colspan=3 | Data columns
|- class=static-row-header
! A !! B !! C
|-
| Red || 1|| 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|} |
Add "No." column header
This adds the No. text as the number column header text. Add class static-row-header-text
to the table wikitext.
|
{{Static row numbers}}
{| class="wikitable sortable static-row-numbers static-row-header-text"
|-
! rowspan=2 | Name
! colspan=3 | Data columns
|-
! A !! B !! C
|-
| Red || 1|| 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|} |
Add hash ("#") column header
This adds the hash (#) symbol as the number column header text. Add class static-row-header-hash
to the table wikitext.
|
{{Static row numbers}}
{| class="wikitable sortable static-row-numbers static-row-header-hash"
|-
! rowspan=2 | Name
! colspan=3 | Data columns
|-
! A !! B !! C
|-
| Red || 1|| 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|} |
No number on specific rows
This disables numbers on specific rows. Add class static-row-header
to the row wikitext. To prevent rows from sorting, add classes sorttop
and/or sortbottom
. For more info, see Help:Sortable tables.
|
{{Static row numbers}}
{| class="wikitable sortable static-row-numbers"
|-
! rowspan=2 | Name
! colspan=3 | Data columns
|-
! A !! B !! C
|-
| Red || 1|| 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|- class="sortbottom static-row-header"
| '''Totals''' || 12 || 15 || 18
|} |
White background on data cells
This adds a white background to data cells. Headers are unaffected. Add class srn-white-background
to the table wikitext. You can set other background colors on specific rows or cells using inline styles. For more info, see Help:Table#Color; scope of parameters.
|
{{Static row numbers}}
{| class="wikitable sortable static-row-numbers srn-white-background"
|-
! rowspan=2 | Name
! colspan=3 | Data columns
|-
! A !! B !! C
|-
| Red || 1|| 2 || style=background:palegreen |3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|- class="sortbottom static-row-header" style=background:yellow
| '''Totals''' || 12 || 15 || 18
|} |
Redirects
- {{Srn}}
- {{Fixed row numbers}}
See also
- {{Sorting row}} - Adds a sorting row. It can't be used with
data-sort-type=number
, or any form ofdata-sort-type=VALUE
, or it breaks sorting. See Help:Sortable tables. - {{mw-datatable}} - Another way to add a white background to data cells.