May 2017
Intermediate to advanced
448 pages
10h 10m
English
Now we want to apply the same kind of sorting behavior to the Author(s) column of our table. Because its table header cell has the sort-alpha class, the Author(s) column can be sorted with our existing code. Ideally, though, authors should be sorted by last name, not first. Since some books have multiple authors, and some authors have middle names or initials listed, we need outside guidance to determine what part of the text to use as our sort key. We can supply this guidance by wrapping the relevant part of the cell in a tag:
<td>David <span class="sort-key">Mercer</span></td>
Now we have to modify our sorting code to take this tag into account without disturbing the existing behavior for the Title ...
Read now
Unlock full access