<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://safernicotine.wiki/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Template%3AStatic_row_numbers%2Fdoc</id>
	<title>Template:Static row numbers/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://safernicotine.wiki/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Template%3AStatic_row_numbers%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Template:Static_row_numbers/doc&amp;action=history"/>
	<updated>2026-04-15T07:06:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://safernicotine.wiki/mediawiki/index.php?title=Template:Static_row_numbers/doc&amp;diff=40707&amp;oldid=prev</id>
		<title>imported&gt;Pppery: Category:Templates using TemplateStyles to style external elements</title>
		<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Template:Static_row_numbers/doc&amp;diff=40707&amp;oldid=prev"/>
		<updated>2023-03-11T01:26:52Z</updated>

		<summary type="html">&lt;p&gt;&lt;a href=&quot;/mediawiki/index.php?title=Category:Templates_using_TemplateStyles_to_style_external_elements&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Templates using TemplateStyles to style external elements (page does not exist)&quot;&gt;Category:Templates using TemplateStyles to style external elements&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&lt;br /&gt;
&amp;lt;!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --&amp;gt;&lt;br /&gt;
{{tsh|srn}}{{Uses TemplateStyles|Template:Static row numbers/styles.css}}&lt;br /&gt;
:&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; [[:Category:Articles with tables with fixed row numbers]] uses a deprecated template. Please replace it with {{tl|Static row numbers}}.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Template to automatically add row numbers to sortable tables. The row numbers will not be sorted when columns of data are sorted. A possible note to add above a table: &amp;lt;code&amp;gt;{{tlx|noprint|&amp;lt;nowiki&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Row numbers&amp;#039;&amp;#039;&amp;#039; are static. Other columns are sortable. This allows ranking of any column.&amp;#039;&amp;#039;&amp;lt;/nowiki&amp;gt;}}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These templates work together and make table formatting fast: &lt;br /&gt;
*{{tl|Static row numbers table}}&lt;br /&gt;
*{{tl|Static row numbers header}}&lt;br /&gt;
*{{tl|Static row numbers arrows}}&lt;br /&gt;
*{{tl|Static row numbers no rank}}&lt;br /&gt;
*{{tl|Static row numbers total}}&lt;br /&gt;
Some are used together here: [[List of U.S. states and territories by incarceration and correctional supervision rate]]&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Usage with &amp;lt;code&amp;gt;wikitable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;sortable&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Place template before table where the automatic row numbers are required. Add class &amp;lt;code&amp;gt;static-row-numbers&amp;lt;/code&amp;gt; to the table wikitext, as in the following example. It adds an unsorted column of row numbers.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;border:solid 1px;&amp;quot;&lt;br /&gt;
|+ With &amp;lt;code&amp;gt;wikitable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;sortable&amp;lt;/code&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable static-row-numbers&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|}&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=text highlight=1-2&amp;gt;&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable static-row-numbers&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Usage with &amp;lt;code&amp;gt;sortable&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;border:solid 1px;&amp;quot;&lt;br /&gt;
|+ With &amp;lt;code&amp;gt;sortable&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;sortable static-row-numbers&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|}&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=text highlight=1-2&amp;gt;&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;sortable static-row-numbers&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Usage with no other classes ==&lt;br /&gt;
&lt;br /&gt;
While designed to provide a static row number for sortable tables, it can be used just to add an automatic row number to plain tables.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;border:solid 1px;&amp;quot;&lt;br /&gt;
|+ With no other classes&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;static-row-numbers&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|}&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=text highlight=1-2&amp;gt;&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;static-row-numbers&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Using &amp;lt;code&amp;gt;static-row-header-text&amp;lt;/code&amp;gt; to add a &amp;quot;No.&amp;quot; column header ==&lt;br /&gt;
&lt;br /&gt;
This adds a &amp;#039;&amp;#039;&amp;#039;&amp;quot;No.&amp;quot;&amp;#039;&amp;#039;&amp;#039; as the row number column header. Add &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;class=static-row-header-text&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; to the top line of the table wikitext. It does not work with {{tl|Static row numbers table}}.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;border:solid 1px;&amp;quot;&lt;br /&gt;
|+ With &amp;lt;code&amp;gt;static-row-header-text&amp;lt;/code&amp;gt; to add a column header&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable static-row-numbers static-row-header-text&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|}&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=text highlight=1-2&amp;gt;&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable static-row-numbers static-row-header-text&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Using &amp;lt;code&amp;gt;static-row-header-hash&amp;lt;/code&amp;gt; to add a hash (&amp;quot;#&amp;quot;) column header ==&lt;br /&gt;
&lt;br /&gt;
This adds a hash (&amp;quot;#&amp;quot;) as the row number column header. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;border:solid 1px;&amp;quot;&lt;br /&gt;
|+ With &amp;lt;code&amp;gt;static-row-header-hash&amp;lt;/code&amp;gt; to add a column header&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable static-row-numbers static-row-header-hash&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|}&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=text highlight=1-2&amp;gt;&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable static-row-numbers static-row-header-hash&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Marking additional header and footer rows with &amp;lt;code&amp;gt;static-row-header&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The class &amp;lt;code&amp;gt;static-row-header&amp;lt;/code&amp;gt; is added to additional header rows (other than the first one). It prevents those header rows from having row numbers. It also prevents them from being sorted. It is important to add this class for consistent appearance in different Wikipedia skins and views. It is necessary for correct numbering in the minerva skin on mobile view which renders HTML tables differently. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;border:solid 1px;&amp;quot;&lt;br /&gt;
|+ Marking additional header and footer rows with &amp;lt;code&amp;gt;static-row-header&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable static-row-numbers&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|- class=&amp;quot;static-row-header&amp;quot;&lt;br /&gt;
!  !! (unit) !! (per capita)&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|- class=&amp;quot;static-row-header&amp;quot;&lt;br /&gt;
! Totals !! 250 !! 3000&lt;br /&gt;
|}&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=text highlight=1-2,4,16&amp;gt;&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable static-row-numbers&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|- class=&amp;quot;static-row-header&amp;quot;&lt;br /&gt;
!  !! (unit) !! (per capita)&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|- class=&amp;quot;static-row-header&amp;quot;&lt;br /&gt;
! Totals !! 250 !! 3000&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Marking footer or header rows that also contain data cells (non-header cells) ==&lt;br /&gt;
&lt;br /&gt;
To prevent them from sorting &amp;lt;code&amp;gt;class=sorttop&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;class=sortbottom&amp;lt;/code&amp;gt; must also be added. For an example of header rows like this see [https://en.wikipedia.org/w/index.php?title=COVID-19_pandemic_deaths&amp;amp;oldid=1038165297#2021 this version] of the 2021 table in [[COVID-19 pandemic deaths#2021|this list article]].&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;border:solid 1px;&amp;quot;&lt;br /&gt;
|+ Marking footer or header rows that also contain data cells (non-header cells)&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable static-row-numbers&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|- class=&amp;quot;static-row-header&amp;quot;&lt;br /&gt;
!  !! (unit) !! (per capita)&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|- class=&amp;quot;sortbottom static-row-header&amp;quot;&lt;br /&gt;
! Totals &lt;br /&gt;
|| 250 || 3000&lt;br /&gt;
|}&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=text highlight=1-2,4,16&amp;gt;&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable static-row-numbers&amp;quot;&lt;br /&gt;
! Name !! Number !! Another Number&lt;br /&gt;
|- class=&amp;quot;static-row-header&amp;quot;&lt;br /&gt;
!  !! (unit) !! (per capita)&lt;br /&gt;
|-&lt;br /&gt;
| A || 10 || 1000&lt;br /&gt;
|-&lt;br /&gt;
| B || 50 || 800&lt;br /&gt;
|-&lt;br /&gt;
| C || 100 || 150&lt;br /&gt;
|-&lt;br /&gt;
| D || 20 || 700&lt;br /&gt;
|-&lt;br /&gt;
| E || 70 || 350&lt;br /&gt;
|- class=&amp;quot;sortbottom static-row-header&amp;quot;&lt;br /&gt;
! Totals &lt;br /&gt;
|| 250 || 3000&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== White background for data cells ==&lt;br /&gt;
&lt;br /&gt;
Add &amp;lt;code&amp;gt;class=srn-white-background&amp;lt;/code&amp;gt; to the top line of the table  wikitext. It can be used on tables with inline cell or row background colors. Neither are affected by this class. &lt;br /&gt;
&lt;br /&gt;
This class is unnecessary if you are using this:&lt;br /&gt;
*&amp;#039;&amp;#039;&amp;#039;{{tl|Static row numbers table}}&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
The class is incorporated into that template. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;border:solid 1px;&amp;quot;&lt;br /&gt;
|+ White background for data cells &lt;br /&gt;
|-&lt;br /&gt;
|{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable static-row-numbers srn-white-background&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 1 !! 2 !! 3&lt;br /&gt;
|-&lt;br /&gt;
| 1-1 || 2-1 || 3-1&lt;br /&gt;
|-&lt;br /&gt;
| 1-2 || 2-2 || 3-2&lt;br /&gt;
|}&lt;br /&gt;
|&lt;br /&gt;
|&amp;lt;syntaxhighlight lang=text highlight=1-2&amp;gt;&lt;br /&gt;
{{Static row numbers}}&lt;br /&gt;
{| class=&amp;quot;wikitable sortable static-row-numbers srn-white-background&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 1 !! 2 !! 3&lt;br /&gt;
|-&lt;br /&gt;
| 1-1 || 2-1 || 3-1&lt;br /&gt;
|-&lt;br /&gt;
| 1-2 || 2-2 || 3-2&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* {{tl|Sorting row}} - a way to add a sorting row with centered sorting icons without using any {{tl|Static row numbers}} templates or sub-templates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{sandbox other||&lt;br /&gt;
&amp;lt;!-- Categories below this line; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:Table templates]]&lt;br /&gt;
[[Category:Templates using TemplateStyles to style external elements]]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>imported&gt;Pppery</name></author>
	</entry>
</feed>