DataTable
Example: Animals
A datatable with default settings.
| Animal | Habitat | Diet | Lifespan | Fun Fact |
|---|---|---|---|---|
| Otter | Rivers, lakes | Fish, crustaceans | 10-25 yrs | Known for sliding on their bellies! |
| Eagle | Mountains, forests | Small mammals, fish | 20-30 yrs | Sharpest eyesight of all birds. |
| Dolphin | Oceans | Fish, squid | 40-50 yrs | Sleep with one eye open (unihemispheric sleep). |
| Sloth | Rainforests | Leaves, fruits | 12-20 yrs | Move slower than a growing grass! |
| Penguin | Antarctica | Fish, krill | 20-30 yrs | Can’t fly but are excellent swimmers. |
Example: Months
A datatable with caption, not searchable, with fixed height.
{{datatable
|searchable=false
|caption=Months
|perpage=5
|fixedheight=true
| No | Month | Length |
| --:| --------- | ------:|
| 1 | January | 31 |
| 2 | Feburary | 28 |
| 3 | March | 31 |
| 4 | April | 30 |
| 5 | May | 31 |
| 6 | June | 30 |
| 7 | July | 31 |
| 8 | August | 31 |
| 9 | September | 30 |
| 10 | October | 31 |
| 11 | November | 30 |
| 12 | December | 31 |
}}
| No | Month | Length |
|---|---|---|
| 1 | January | 31 |
| 2 | Feburary | 28 |
| 3 | March | 31 |
| 4 | April | 30 |
| 5 | May | 31 |
| 6 | June | 30 |
| 7 | July | 31 |
| 8 | August | 31 |
| 9 | September | 30 |
| 10 | October | 31 |
| 11 | November | 30 |
| 12 | December | 31 |
Example: from a CSV attachment
A src pointing at a CSV attachment renders it as a datatable. This page has
otters.csv attached (delimiter ;, with a header row, both defaults).
{{datatable
|src=otters.csv
|caption=Otters
}}
| Species | Family | Habitat | Weight kg |
|---|---|---|---|
| Sea Otter | Mustelidae | Coastal waters | 30 |
| River Otter | Mustelidae | Rivers and lakes | 11 |
| Giant Otter | Mustelidae | Amazon basin | 32 |
| Asian Small-clawed Otter | Mustelidae | Wetlands | 3 |
Example: selecting columns with column0
column0 picks which columns to show using 0-based indices, so 0,2 keeps the
first and third columns (Species and Habitat). It is the same as columns,
which counts from 1 instead. An absolute src reads the CSV from another page;
here it points back at this page's own attachment.
{{datatable
|src=/Examples/DataTable/otters.csv
|column0=0,2
|caption=Species and habitat
}}
| Species | Habitat |
|---|---|
| Sea Otter | Coastal waters |
| River Otter | Rivers and lakes |
| Giant Otter | Amazon basin |
| Asian Small-clawed Otter | Wetlands |
