Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
animals [2020/03/25 00:04] saph Allowed for sorting the animals table by the different columns |
animals [2020/03/29 23:21] saph updated sorting function |
||
---|---|---|---|
Line 91: | Line 91: | ||
< | < | ||
<div class=" | <div class=" | ||
- | <table class=" | + | < |
< | < | ||
<tr> | <tr> | ||
Line 260: | Line 260: | ||
if (dir == " | if (dir == " | ||
- | if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) { | + | if ((!isNaN(x.innerHTML) && parseFloat(x.innerHTML) > parseFloat(y.innerHTML)) || |
+ | (isNaN(x.innerHTML) && | ||
shouldSwitch = true; | shouldSwitch = true; | ||
break; | break; | ||
} | } | ||
} else if (dir == " | } else if (dir == " | ||
- | if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) { | + | if ((!isNaN(x.innerHTML) && parseFloat(x.innerHTML) < parseFloat(y.innerHTML)) || |
+ | (isNaN(x.innerHTML) && | ||
shouldSwitch = true; | shouldSwitch = true; | ||
break; | break; |