Here naverokê

Şablon:Static row numbers

Ji Wîkîpediya, ensîklopediya azad.
Belgekirina şablonê[nîşan bide] [biguhêre] [dîrokê bibîne] [rojane bike]

This template automatically adds an unsortable column of row numbers to tables. It works in desktop and mobile views.

Works with wikitable, sortable, and plain tables, although implementation may differ slightly. Include this template before the table and add the class static-row-numbers to the table wikitext.

{{Static row numbers}}
{| class="static-row-numbers"

Sub-templates:

Usage with wikitable and sortable

[çavkaniyê biguhêre]

Wikitext:

{{Static row numbers}}
{| class="wikitable sortable static-row-numbers"
|- 
! rowspan="2" | Color
! colspan="3" | Data
|- 
! A !! B !! C
|-
| Red || 1 || 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|}

Produces:

Color Data
A B C
Red 1 2 3
Lime 4 5 6
Gold 7 8 9

Usage with wikitable

[çavkaniyê biguhêre]

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.

Wikitext:

{{Static row numbers}}
{| class="wikitable static-row-numbers"
|- class="static-row-header"
! rowspan="2" | Color
! colspan="3" | Data
|- class="static-row-header"
! A !! B !! C
|-
| Red || 1 || 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|}

Produces:

Color Data
A B C
Red 1 2 3
Lime 4 5 6
Gold 7 8 9

Usage with sortable

[çavkaniyê biguhêre]

Wikitext:

{{Static row numbers}}
{| class="sortable static-row-numbers"
|-
! rowspan="2" | Color
! colspan="3" | Data
|- 
! A !! B !! C
|-
| Red || 1 || 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|}

Produces:

Color Data
A B C
Red 1 2 3
Lime 4 5 6
Gold 7 8 9

Usage with plain tables

[çavkaniyê biguhêre]

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.

Wikitext:

{{Static row numbers}}
{| class="static-row-numbers"
|-
! rowspan="2" | Color
! colspan="3" | Data
|- class="static-row-header"
! A !! B !! C
|-
| Red || 1 || 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|}

Produces:

Color Data
A B C
Red 1 2 3
Lime 4 5 6
Gold 7 8 9

Add "No." column header

[çavkaniyê biguhêre]

This adds the No. text as the number column header text. Add class static-row-header-text to the table wikitext.

Wikitext:

{{Static row numbers}}
{| class="wikitable sortable static-row-numbers static-row-header-text"
|- 
! rowspan="2" | Color
! colspan="3" | Data
|- 
! A !! B !! C
|-
| Red || 1 || 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|}

Produces:

Color Data
A B C
Red 1 2 3
Lime 4 5 6
Gold 7 8 9

Add hash ("#") column header

[çavkaniyê biguhêre]

This adds the hash (#) symbol as the number column header text. Add class static-row-header-hash to the table wikitext.

Wikitext:

{{Static row numbers}}
{| class="wikitable sortable static-row-numbers static-row-header-hash"
|- 
! rowspan="2" | Color
! colspan="3" | Data
|- 
! A !! B !! C
|-
| Red || 1 || 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|}

Produces:

Color Data
A B C
Red 1 2 3
Lime 4 5 6
Gold 7 8 9

No number on specific rows

[çavkaniyê biguhêre]

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.

Wikitext:

{{Static row numbers}}
{| class="wikitable sortable static-row-numbers"
|- 
! rowspan="2" | Color
! colspan="3" | Data
|- 
! A !! B !! C
|-
| Red || 1 || 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|- class="sortbottom static-row-header"
| '''Totals''' || 12 || 15 || 18
|}

Produces:

Color Data
A B C
Red 1 2 3
Lime 4 5 6
Gold 7 8 9
Totals 12 15 18

White background on data cells

[çavkaniyê biguhêre]

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.

Wikitext:

{{Static row numbers}}
{| class="wikitable sortable static-row-numbers srn-white-background"
|-
! rowspan="2" | Color
! colspan="3" | Data
|-
! A !! B !! C
|-
| Red || 1 || 2 || 3
|-
| Lime || 4 || 5 || 6
|-
| Gold || 7 || 8 || 9
|- class="sortbottom static-row-header" style="background: yellow;"
| '''Totals''' || 12 || 15 || 18
|}

Produces:

Color Data
A B C
Red 1 2 3
Lime 4 5 6
Gold 7 8 9
Totals 12 15 18
  • {{Sorting row}} - Adds a sorting row. It can't be used with data-sort-type=number, or any form of data-sort-type=VALUE, or it breaks sorting. See Help:Sortable tables.
  • {{mw-datatable}} - Another way to add a white background to data cells.