animals

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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:
 <h2><span class="mw-headline" id="Animal_List">Animal List</span></h2> <h2><span class="mw-headline" id="Animal_List">Animal List</span></h2>
 <div class="table-responsive"> <div class="table-responsive">
-<table class="table table-bordered table-striped table-hover">+<table id="animalTable" class="table table-bordered table-striped table-hover">
   <thead>   <thead>
     <tr>     <tr>
Line 260: Line 260:
  
             if (dir == "asc") {             if (dir == "asc") {
-                if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {+                if ((!isNaN(x.innerHTML) && parseFloat(x.innerHTML) > parseFloat(y.innerHTML)) || 
 +                        (isNaN(x.innerHTML) && x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase())) {
                     shouldSwitch = true;                     shouldSwitch = true;
                     break;                     break;
                 }                 }
             } else if (dir == "desc") {             } else if (dir == "desc") {
-                if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {+                if ((!isNaN(x.innerHTML) && parseFloat(x.innerHTML) < parseFloat(y.innerHTML)) || 
 +                        (isNaN(x.innerHTML) && x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase())) {
                     shouldSwitch = true;                     shouldSwitch = true;
                     break;                     break;
  • animals.txt
  • Last modified: 2022/03/17 16:12
  • by aster