Fixup table rendering

This commit is contained in:
hodasemi 2018-11-15 16:53:57 +01:00
parent 65c3f0cacc
commit ff604645b1
4 changed files with 63 additions and 52 deletions

View file

@ -148,11 +148,11 @@ h1 {
margin-bottom: 15px;
vertical-align: middle;
width: 100%;
overflow-x: scroll;
overflow: hidden;
}
.world_table {
width: 100%
width: 100%;
}
.world_table tr:nth-child(odd) {
@ -162,6 +162,7 @@ h1 {
.world_table th {
background-color: #fff;
white-space: nowrap; /* kein umbruch bei schmaler ansicht */
padding-right: 1em;
}
.world_table th:hover {
@ -173,12 +174,15 @@ h1 {
color: lightgreen;
}
.world_table th td {
.world_table td {
line-height: 1em;
padding: 11px 0;
font-size: 14px; /* same as section */
white-space: nowrap;
padding-right: 1em;
}
/*
@media only screen and (max-width: 700px) {
.world_table>tbody>tr>td,
.world_table>tbody>tr>th,
@ -191,8 +195,8 @@ h1 {
display: none;
}
}
*/
/*
@media only screen and (max-width: 1200px) {
.world_table th:nth-child(n+7), .world_table td:nth-child(n+7) {
display: none;
@ -208,7 +212,6 @@ h1 {
display: none;
}
}
*/
.boxed {
border: 1px solid green;

View file

@ -72,7 +72,7 @@ error_reporting(E_ALL);
</section>
<div class="page">
<div id="footer_div" class="page">
<footer class="footer">
<div class="foo-left">
<p>Copyright © 2018 world_data</p>

View file

@ -43,25 +43,28 @@ function rerequestFile(path, columns) {
}
function processData(csv, path) {
let table = document.getElementById('t01');
if (table) {
var columnAmount = 7;
var table = "";
var table_content = "";
var checkbox = "";
// split rows
var allTextLines = csv.split(/\r\n|\n/);
// create table header
table += "<thead><tr>";
table_content += "<thead><tr>";
checkbox += "<ul>";
var data = allTextLines[0].split(",");
for (var j = 0; j < columnAmount; j++) {
// create table column header
table += "<th onclick=\"sortTable(" + j + ")\" >";
table += stringPerToSlash(data[j]);
table += ' <i class="fas fa-chevron-up"></i>&nbsp;<i class="fas fa-chevron-down"></i>';
table += "</th>";
table_content += "<th onclick=\"sortTable(" + j + ")\" >";
table_content += stringPerToSlash(data[j]);
table_content += ' <i class="fas fa-chevron-up"></i>&nbsp;<i class="fas fa-chevron-down"></i>';
table_content += "</th>";
// create dropdown elements
checkbox += "<li>";
@ -71,27 +74,28 @@ function processData(csv, path) {
}
checkbox += "</ul>";
table += "</tr></thead><tbody>";
table_content += "</tr></thead><tbody>";
// create table content
for (var i = 1; i < allTextLines.length; i++) {
var data = allTextLines[i].split(',');
table += "<tr>";
table_content += "<tr>";
for (var j = 0; j < columnAmount; j++) {
table += "<td>";
table += data[j];
table += "</td>";
table_content += "<td>";
table_content += data[j];
table_content += "</td>";
}
table += "</tr>";
table_content += "</tr>";
}
table += "</tbody>";
table_content += "</tbody>";
document.getElementById('t01').innerHTML = table;
table.innerHTML = table_content;
document.getElementById('options').innerHTML = checkbox;
}
}
function toggleColumn(file) {

View file

@ -59,6 +59,7 @@
<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>
@ -94,6 +95,7 @@
<i class="fas fa-chevron-up"></i>
<i class="fas fa-chevron-down"></i>
</th>
-->
</tr>
</thead>
<tbody>
@ -106,6 +108,7 @@
<td><xsl:value-of select="children_per_woman"/></td>
<td><xsl:value-of select="electricity_consumption_per_capita"/></td>
<td><xsl:value-of select="gdp_per_capita"/></td>
<!--
<td><xsl:value-of select="gdp__per__capita__growth"/></td>
<td><xsl:value-of select="inflation_annual"/></td>
<td><xsl:value-of select="internet_user_per_100"/></td>
@ -113,6 +116,7 @@
<td><xsl:value-of select="military_expenditure_percent_of_gdp"/></td>
<td><xsl:value-of select="gps_lat"/></td>
<td><xsl:value-of select="gps_long"/></td>
-->
</tr>
</xsl:for-each>
</tbody>