This sandbox is using {{sticky header/testcases}}. I added some more table widths. I also made some of the wide tables wider so that they would extend past the screen in landscape orientation even on larger cell phones. I removed the divs.

See: User:Timeshifter/Sandbox244. And: Sandbox245 and Sandbox247 (narrow 3-column tables only). And: Template:Sticky header.


Test sticky-header (no caption) edit

Sticky first row.

Wikitable:

Wikitable wikitext:

{{Sticky header/sandbox}}
{| class="wikitable sticky-header"
|-
! Header !! Header 2 !! Header 3 !! Header 4
! Header 5 !! Header 6 !! Header 7 !! Header 8
! Header 9 || Header 10 || Header 11 || Header 12 || Header 13|}


Plain table:


Plain table wikitext:

{{Sticky header/sandbox}}
{| class="sticky-header"
|-
! Header !! Header 2 !! Header 3 !! Header 4
! Header 5 !! Header 6 !! Header 7 !! Header 8
! Header 9|}


Test sticky-header (no caption). Narrower tables edit

Plain table:

Test sticky-header (caption) edit

Sticky first row.

Wikitable:


Wikitable wikitext:

{{Sticky header/sandbox}}
{| class="wikitable sticky-header"
|+ Caption
|-
! Header !! Header 2 !! Header 3 !! Header 4
! Header 5 !! Header 6 !! Header 7 !! Header 8
! Header 9|}


Plain table:


Plain table wikitext:

{{Sticky header/sandbox}}
{| class="sticky-header"
|+ Caption
|-
! Header !! Header 2 !! Header 3 !! Header 4
! Header 5 !! Header 6 !! Header 7 !! Header 8
! Header 9|}


Test sticky-header (sortable) edit

Sticky first row.

Wikitable:


Wikitable wikitext:

{{Sticky header/sandbox}}
{| class="wikitable sortable sticky-header"
|+ Caption
|-
! Header !! Header 2 !! Header 3 !! Header 4
! Header 5 !! Header 6 !! Header 7 !! Header 8
! Header 9 !! Header 10 !! Header 11 !! Header 12
! Header 13 !! Header 14 !! Header 15 
! class="unsortable" | Header 16
|- class="sorttop"
| top || top || top || top || top || top 
| top || top || top || top || top || top 
| top || top || top || top 
...
|- class="sortbottom"
| bottom || bottom || bottom || bottom || bottom || bottom
| bottom || bottom || bottom || bottom || bottom || bottom 
| bottom || bottom || bottom || bottom 
|}


Plain table:


Plain table wikitext:

{{Sticky header/sandbox}}
{| class="sortable sticky-header"
|+ Caption
|-
! Header !! Header 2 !! Header 3 !! Header 4
! Header 5 !! Header 6 !! Header 7 !! Header 8
! class="unsortable" | Header 9
|- class="sorttop"
| top || top || top || top || top
| top || top || top || top
⫶
|- class="sortbottom"
| bottom || bottom || bottom || bottom || bottom
| bottom || bottom || bottom || bottom
|}

Test sticky-header (sortable). Narrower tables edit

Plain table:

Test sticky-header-multi. 2 rows. (sortable) edit

Sticky <thead> element.

Issues:

  • Nothing sticky if JavaScript disabled, which is used by sortable, currently the only way to move headers to the <thead> element.
  • Sticky sorttop rows, which sortable moves to the <thead> element after sorting.

Wikitable:

Caption
Header Header group
Header 2 Header 3 Header 4 Header 5 Header 6 Header 7 Header 8 Header 9
top top top top top top top top top
3 data data data data data data data b
1 data data data data data data data c
2 data data data data data data data a
bottom bottom bottom bottom bottom bottom bottom bottom bottom


Wikitable wikitext:

{{Sticky header/sandbox}}
{| class="wikitable sortable sticky-header-multi"
|+ Caption
|-
! rowspan="2" | Header
! colspan="8" | Header group
|-
! Header 2 !! Header 3 !! Header 4 !! Header 5
! Header 6 !! Header 7 !! Header 8
! class="unsortable" | Header 9
|- class="sorttop"
| top || top || top || top || top
| top || top || top || top
⫶
|- class="sortbottom"
| bottom || bottom || bottom || bottom || bottom
| bottom || bottom || bottom || bottom
|}


Plain table:

Caption
Header Header group
Header 2 Header 3 Header 4 Header 5 Header 6 Header 7 Header 8 Header 9
top top top top top top top top top
3 data data data data data data data b
1 data data data data data data data c
2 data data data data data data data a
bottom bottom bottom bottom bottom bottom bottom bottom bottom


Plain table wikitext:

{{Sticky header/sandbox}}
{| class="sortable sticky-header-multi"
|+ Caption
|-
! rowspan="2" | Header
! colspan="8" | Header group
|-
! Header 2 !! Header 3 !! Header 4 !! Header 5
! Header 6 !! Header 7 !! Header 8
! class="unsortable" | Header 9
|- class="sorttop"
| top || top || top || top || top
| top || top || top || top
⫶
|- class="sortbottom"
| bottom || bottom || bottom || bottom || bottom
| bottom || bottom || bottom || bottom
|}

Test template static row numbers (sticky-header, no caption) edit

Uses {{static row numbers}} with adjusted wikitable borders.


No label:


Label:


Test template static row numbers (sticky-header, caption) edit

Uses {{static row numbers}} with adjusted wikitable borders.


No label:


Label:


Test template static row numbers (sticky-header, sortable) edit

Uses {{static row numbers}} with adjusted wikitable borders.


No label:


Label:


Test template static row numbers. 2 rows. (sticky-header-multi, sortable) edit

Uses {{static row numbers}} with adjusted wikitable borders.


No label:

Caption
Header group
Header Header
top top
top top
rank 1 data
rank 2 data
norank 1 data
norank 2 data
rank 3 data
rank 4 data
bottom bottom
bottom bottom


Label:

Caption
Header group
Header Header
top top
top top
rank 1 data
rank 2 data
norank 1 data
norank 2 data
rank 3 data
rank 4 data
bottom bottom
bottom bottom

Test template static row numbers. 2 rows. (sticky-header-multi, sortable). Wide table edit

Uses {{static row numbers}} with adjusted wikitable borders.


No label:

Caption
Header group
Header Header Header Header Header Header Header Header
top top top top top top top top
top top top top top top top top
rank 1 data data data data data data data
rank 2 data data data data data data data
norank 1 data data data data data data data
norank 2 data data data data data data data
rank 3 data data data data data data data
rank 4 data data data data data data data
bottom bottom bottom bottom bottom bottom bottom bottom
bottom bottom bottom bottom bottom bottom bottom bottom

Padding edit

Padding for testing purposes.