Difference between revisions of "Help:Sorting"
(table) |
m (Protected "Help:Sorting" [edit=sysop:move=sysop]) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | == Make a Table Sortable == | ||
+ | |||
Tables can be made sortable by typing class="sortable" in the first line of the table. | Tables can be made sortable by typing class="sortable" in the first line of the table. | ||
Line 39: | Line 41: | ||
| 5'0" | | 5'0" | ||
|} | |} | ||
+ | |||
Sortable tables are identified by the arrows in each of its header cells. Clicking them will cause the table rows to sort based on the selected column, in ascending order first, and subsequently toggling between ascending and descending order. Links and other wiki-markup are not possible in headers. | Sortable tables are identified by the arrows in each of its header cells. Clicking them will cause the table rows to sort based on the selected column, in ascending order first, and subsequently toggling between ascending and descending order. Links and other wiki-markup are not possible in headers. | ||
+ | |||
+ | |||
+ | == Exclude a Row from Sorting == | ||
+ | |||
+ | You can exclude the last row of a table from the sorting process by typing class="sortbottom" on the desired table row (line starting with |-). | ||
+ | |||
+ | <nowiki>{| border= "1" class="sortable" | ||
+ | ! Name | ||
+ | ! Age | ||
+ | ! Height | ||
+ | |- | ||
+ | | Joe | ||
+ | | 14 | ||
+ | | 5'3" | ||
+ | |- | ||
+ | | Sally | ||
+ | | 39 | ||
+ | | 6'1" | ||
+ | |- | ||
+ | | Bill | ||
+ | | 89 | ||
+ | | 5'0" | ||
+ | |- class = "sortbottom" | ||
+ | | '''Average''' | ||
+ | | 47.3 | ||
+ | | 5'5" | ||
+ | |} </nowiki> | ||
+ | |||
+ | |||
+ | Which shows up like this on your web page: | ||
+ | |||
+ | {| border= "1" class="sortable" | ||
+ | ! Name | ||
+ | ! Age | ||
+ | ! Height | ||
+ | |- | ||
+ | | Joe | ||
+ | | 14 | ||
+ | | 5'3" | ||
+ | |- | ||
+ | | Sally | ||
+ | | 39 | ||
+ | | 6'1" | ||
+ | |- | ||
+ | | Bill | ||
+ | | 89 | ||
+ | | 5'0" | ||
+ | |- class = "sortbottom" | ||
+ | |''' Average''' | ||
+ | | 47.3 | ||
+ | | 5'5" | ||
+ | |} | ||
+ | |||
+ | |||
+ | Only one row can be marked with class="sortbottom". Otherwise results in the marked rows will be sorted with each other. | ||
+ | |||
+ | |||
+ | == Exclude a Column from Sorting == | ||
+ | |||
+ | If you want a specific column not to be sortable, write class="unsortable" followed by a pipe ( | ) and the column title in its header cell. | ||
+ | |||
+ | <nowiki>{| border= "1" class="sortable" | ||
+ | ! Name | ||
+ | ! Age | ||
+ | ! class = "unsortable" | Height | ||
+ | |- | ||
+ | | Joe | ||
+ | | 14 | ||
+ | | 5'3" | ||
+ | |- | ||
+ | | Sally | ||
+ | | 39 | ||
+ | | 6'1" | ||
+ | |- | ||
+ | | Bill | ||
+ | | 89 | ||
+ | | 5'0" | ||
+ | |} </nowiki> | ||
+ | |||
+ | |||
+ | Which shows up like this on your web page: | ||
+ | |||
+ | {| border= "1" class="sortable" | ||
+ | ! Name | ||
+ | ! Age | ||
+ | ! class="unsortable" | Height | ||
+ | |- | ||
+ | | Joe | ||
+ | | 14 | ||
+ | | 5'3" | ||
+ | |- | ||
+ | | Sally | ||
+ | | 39 | ||
+ | | 6'1" | ||
+ | |- | ||
+ | | Bill | ||
+ | | 89 | ||
+ | | 5'0" | ||
+ | |} | ||
+ | |||
+ | |||
+ | As you see, the sorting arrows do not show up on the "Height" column. | ||
+ | |||
+ | |||
+ | == See also: == | ||
+ | |||
+ | [http://en.wikipedia.org/wiki/Help:Sorting Sorting Help on Wikipedia] | ||
+ | |||
+ | [[Category:Help Pages]] |
Latest revision as of 15:11, 25 July 2008
Make a Table Sortable
Tables can be made sortable by typing class="sortable" in the first line of the table.
{| border= "1" class="sortable" ! Name ! Age ! Height |- | Joe | 14 | 5'3" |- | Sally | 39 | 6'1" |- | Bill | 89 | 5'0" |}
Which shows up like this on your web page:
Name | Age | Height |
---|---|---|
Joe | 14 | 5'3" |
Sally | 39 | 6'1" |
Bill | 89 | 5'0" |
Sortable tables are identified by the arrows in each of its header cells. Clicking them will cause the table rows to sort based on the selected column, in ascending order first, and subsequently toggling between ascending and descending order. Links and other wiki-markup are not possible in headers.
Exclude a Row from Sorting
You can exclude the last row of a table from the sorting process by typing class="sortbottom" on the desired table row (line starting with |-).
{| border= "1" class="sortable" ! Name ! Age ! Height |- | Joe | 14 | 5'3" |- | Sally | 39 | 6'1" |- | Bill | 89 | 5'0" |- class = "sortbottom" | '''Average''' | 47.3 | 5'5" |}
Which shows up like this on your web page:
Name | Age | Height |
---|---|---|
Joe | 14 | 5'3" |
Sally | 39 | 6'1" |
Bill | 89 | 5'0" |
Average | 47.3 | 5'5" |
Only one row can be marked with class="sortbottom". Otherwise results in the marked rows will be sorted with each other.
Exclude a Column from Sorting
If you want a specific column not to be sortable, write class="unsortable" followed by a pipe ( | ) and the column title in its header cell.
{| border= "1" class="sortable" ! Name ! Age ! class = "unsortable" | Height |- | Joe | 14 | 5'3" |- | Sally | 39 | 6'1" |- | Bill | 89 | 5'0" |}
Which shows up like this on your web page:
Name | Age | Height |
---|---|---|
Joe | 14 | 5'3" |
Sally | 39 | 6'1" |
Bill | 89 | 5'0" |
As you see, the sorting arrows do not show up on the "Height" column.