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) {
var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
table = document.getElementById("t01");
switching = true;
table = document.getElementById("t01");
// xslt table workaround
if (table === null) {
table = document.getElementById("t02");
}
// Set the sorting direction to ascending:
dir = "asc";

View file

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