Open danielt113 opened 8 years ago
I think that as soon as you added letters to the distance, the sorting changed from numeric to string. Style-wise, I remember that my science teachers would have been upset with me if I didn't write the units in the column header.
But maybe you could benefit from the "Hidden title numeric sorting" article on the DataTables website: https://datatables.net/plug-ins/sorting/title-numeric
I would look into: https://www.datatables.net/examples/advanced_init/html5-data-attributes.html.
The Canada.ca Content Style Guide has comprehensive guidance on tables: https://www.canada.ca/en/treasury-board-secretariat/services/government-communications/canada-content-style-guide.html#wp5-3
(and @RobJohnston is right - it is good style to put the units in to header)
I have a table that shows distances to passport offices. The distance column is sorted numerically but when I put in "Km" after each number it sorts it alphabetically. So it sorts looks like:
Is it possible to have units after each number in the cell without affecting the sorting method?