Help:Wiki University Wikitext--Tables - Sorting

Table sorting
Sometimes table can get really long and finding what you are looking for can be hard. To help with this we can use a "class" called sorting This will allow us to sort alphabetically any particular column.
 * It is place in the beginning table tag like so:
 * {| class="sortable" style="border:1px solid red: width:50% .....

Here is what the table will look like with the sorting class in the beginning header tag: If you click on these icons you will see the column arrange itself in alphabetical order.
 * NOTICE a small hour glass like icon has appeared along side the headers.

Rows stay together
This is important. If you have a table of name and address, you will want the addresses to stay with the name if they were sorted alphabetically. This sorting attribute then allows you to add items without having to worry about the order.
 * PLEASE NOTICE CAREFULLY the items in the rows stay will the item in the column that you have alphabetically rearranged. It dose not matter which column you click.
 * NOTICE however, when you leave the page the table is on, the order reverts back to the original. The sorting only last as long as you are on the sorted table.

 Exercises
 * Take our demonstration table and make it sortable.
 * Add one more row of items to this table and try out the sortable icon.

Check your answers >

 Quick Quiz
 * When you click the sorting icon, the sorting is permanent.
 * A. True
 * B. False


 * When you add items to a table, you need to insert the item in the table where it is supposed to go if you want your table in alphabetical order.
 * A. True
 * B. False


 * Sorting will revert back to the original order if you leave the page the table is on.
 * A. True
 * B. False

Check your answers >