How do I sort data?

A table can be sorted by clicking the header of one of its columns. Clicking the header once will order the rows in an ascending fashion (e.g. 0 – 9, A – Z). Clicking again will sort the rows in descending order (e.g. Z – A, 9 – 0). Clicking the header a third time will remove any custom ordering, and the table will revert to its natural order. Below you can see how the order would change if we were to click the header of a "Name" column.

The natural order of the table is determined by a number of different factors, and for this exercise, is unimportant to us. Just know that the natural order is simply the order of the table without any custom sorting parameters.

Users (Natural Order)
Name ↕︎ Age Gender
Gary 45 Male
Jenny 32 Female
Bobby 28 Male

When the order is ascending, the names are ordered alphanumerically from 0 to 9, then A to Z. This means that if a name begins with a number — pretty improbable, but you never know — it will be listed first, followed by names that start with "A," then names that start with "B," and so on. Thus, "Alberta" would be listed before "Ben," and "Ben" would be listed before "Cathy." Using the table from before, here's how it would look when sorted by "Name" in ascending order:

Users (Ascending Order)
Name Age Gender
Bobby 28 Male
Gary 45 Male
Jenny 32 Female

Users (Descending Order)
Name Age Gender
Jenny 32 Female
Gary 45 Male
Bobby 28 Male

Still need help? Contact Us Contact Us