Template:Prettytable/Documentation: Difference between revisions

Template page
w:c:strategywiki>DrBob
(Created)
 
w:c:strategywiki>Notmyhandle
(parameters section, full example)
Line 2: Line 2:
By default it will make the table occupy all the page's width. If you want to turn it off, call the template as follows: <nowiki>{{prettytable|notwide=1}}</nowiki>. Additionally, you can mark the table as sortable (i.e. if it's a table of sortable values, such as {{t|yes}} or {{t|no}}), by using the "sortable" parameter: <nowiki>{{prettytable|sortable=1}}</nowiki>. Text can be centred in the table using <nowiki>{{prettytable|text center=1}}</nowiki>. Finally, extra styling can be added using the "style" parameter.
By default it will make the table occupy all the page's width. If you want to turn it off, call the template as follows: <nowiki>{{prettytable|notwide=1}}</nowiki>. Additionally, you can mark the table as sortable (i.e. if it's a table of sortable values, such as {{t|yes}} or {{t|no}}), by using the "sortable" parameter: <nowiki>{{prettytable|sortable=1}}</nowiki>. Text can be centred in the table using <nowiki>{{prettytable|text center=1}}</nowiki>. Finally, extra styling can be added using the "style" parameter.


== Example ==
==Parameters==
*'''notwide''': If a value is given (1, 0 or anything) it will make the table not stretch to fit the area it is contained in.
*'''sortable''': If a value is given, it allows columns to be sorted by clicking on the little icon within the header cell at the top of the column.
*'''text center''':If a value is given, text will be center aligned.
*'''style''':Additional style values are allowed; usage is simply the css values surrounded by quotes.


=== Wide ===
==Example==
===Wide===


<pre>{| {{prettytable}}
<pre>{| {{prettytable}}
Line 26: Line 31:
|}
|}


=== Not wide ===
===Not wide===
 
<pre>{| {{prettytable|notwide=1}}
<pre>{| {{prettytable|notwide=1}}
| Boo!
| Boo!
Line 46: Line 50:
| 2
| 2
| 3
| 3
|}
===Full Example===
<pre>{| {{prettytable|notwide=1|sortable=1|text center=1|style="font-size:11px"}}
! First Column !! Second Column !! Third Column
|-
|A||B||C
|-
|1||2||3
|}</pre>
{| {{prettytable|notwide=1|sortable=1|text center=1|style="font-size:11px"}}
! First Column !! Second Column !! Third Column
|-
|A||B||C
|-
|1||2||3
|}
|}

Revision as of 00:39, 7 April 2007

Template to put at the top of table declarations to standardise and prettify their appearance. By default it will make the table occupy all the page's width. If you want to turn it off, call the template as follows: {{prettytable|notwide=1}}. Additionally, you can mark the table as sortable (i.e. if it's a table of sortable values, such as {{yes}} or {{no}}), by using the "sortable" parameter: {{prettytable|sortable=1}}. Text can be centred in the table using {{prettytable|text center=1}}. Finally, extra styling can be added using the "style" parameter.

Parameters

  • notwide: If a value is given (1, 0 or anything) it will make the table not stretch to fit the area it is contained in.
  • sortable: If a value is given, it allows columns to be sorted by clicking on the little icon within the header cell at the top of the column.
  • text center:If a value is given, text will be center aligned.
  • style:Additional style values are allowed; usage is simply the css values surrounded by quotes.

Example

Wide

{| {{prettytable}}
| Boo!
| Foo
| Bar
|-
| Test
| 2
| 3
|}
Boo! Foo Bar
Test 2 3

Not wide

{| {{prettytable|notwide=1}}
| Boo!
| Foo
| Bar
|-
| Test
| 2
| 3
|}
Boo! Foo Bar
Test 2 3

Full Example

{| {{prettytable|notwide=1|sortable=1|text center=1|style="font-size:11px"}}
! First Column !! Second Column !! Third Column
|-
|A||B||C
|-
|1||2||3
|}
First Column Second Column Third Column
A B C
1 2 3