Fix sorting

This commit is contained in:
hodasemi 2018-11-14 22:15:00 +01:00
parent 6925499682
commit ed0c2ef328
2 changed files with 26 additions and 48 deletions

View file

@ -176,9 +176,15 @@ function updateTable(csv, columns) {
function sortTable(n) { function sortTable(n) {
var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0; var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
table = document.getElementById("t01");
switching = true; switching = true;
table = document.getElementById("t01");
// xslt table workaround
if (table === null) {
table = document.getElementById("t02");
}
// Set the sorting direction to ascending: // Set the sorting direction to ascending:
dir = "asc"; dir = "asc";

View file

@ -21,106 +21,78 @@
<body> <body>
<h1>World Data Overview ...</h1> <h1>World Data Overview ...</h1>
<div class="table-wrapper"> <div class="table-wrapper">
<table class="world_table"> <table id="t02" class="world_table">
<thead> <thead>
<tr> <tr>
<th onclick="sortTable(0)"> <th onclick="sortTable(0)">
id id
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
<th onclick="sortTable(1)"> <th onclick="sortTable(1)">
name name
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
<th onclick="sortTable(2)"> <th onclick="sortTable(2)">
birth rate / 1000 birth rate / 1000
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
<th onclick="sortTable(3)"> <th onclick="sortTable(3)">
cell phones / 100 cell phones / 100
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
<th onclick="sortTable(4)"> <th onclick="sortTable(4)">
children / woman children / woman
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
<th onclick="sortTable(5)"> <th onclick="sortTable(5)">
electricity consumption / capita electricity consumption / capita
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
<th onclick="sortTable(6)"> <th onclick="sortTable(6)">
gdp / capita gdp / capita
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
<th onclick="sortTable(7)"> <th onclick="sortTable(7)">
gdp / capita growth gdp / capita growth
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
<th onclick="sortTable(8)"> <th onclick="sortTable(8)">
inflation_annual inflation_annual
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
<th onclick="sortTable(9)"> <th onclick="sortTable(9)">
internet user / 100 internet user / 100
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
<th onclick="sortTable(10)"> <th onclick="sortTable(10)">
life expectancy life expectancy
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
<th onclick="sortTable(11)"> <th onclick="sortTable(11)">
military expenditure percent of gdp military expenditure percent of gdp
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
<th onclick="sortTable(12)"> <th onclick="sortTable(12)">
gps lat gps lat
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
<th onclick="sortTable(13)"> <th onclick="sortTable(13)">
gps long gps long
<!-- <i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-up"></i>&nbsp;
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
-->
</th> </th>
</tr> </tr>
</thead> </thead>