[EDIT: These are all great methods for changing the way I sort. However I can't change the sorting method, unless one of you knows how to do that. In my JS there is a very long sorting algorithm that I didn't write. I'm not really sure how I would edit it to incorporate any of these sorting methods. Hence why I asked for a way to make them sort alphabetically by just changing the strings themselves.]
I have a table that has a sort button and everything works except for 1 column.
How do I sort 6", 12", and 18"?
They sort in the order 6" 18" 12" because of the quotes. I dont really want to remove the quotes and specify in the header that it is measured in inches... and I dont want to put a 0 before the 6 (which would also work). Ideally I want to put a space before the 6, but that space gets ignored for sorting. Anyone have any thoughts?
My inputs are just defined in a simple array:
var paras1 = [
["K"],
["-270°C to 1372°C, –454°F to 2501°F"],
['0.125 (1/8")', '0.1875 (3/16")', '0.250 (1/4")'],
['6"', '12"', '18"'], //-------THE LINE THAT I CARE ABOUT-------
["316SS"],
["Grounded", "Ungrounded", "Exposed"],
];
Ive tried the following:
[' 6"', '12"', '18"'] //with space doesnt work
['06"', '12"', '18"'] //with 0 works and looks ugly
['6', '12', '18'] //works but not what i want
If you have some creative characters that would help sort, you can try them out on line 486 if that helps, https://jsfiddle.net/msirkin/duw5nyqe/9/
"while sorting. You don't have to do it permanently.sorttable_numericto the column header cell (the one containing the textLength). I just tested it and that works.