From e49fde0d9c1b83e4a0d8ba608b482fec9050ab14 Mon Sep 17 00:00:00 2001
From: hodasemi
Date: Fri, 2 Nov 2018 09:58:02 +0100
Subject: [PATCH] Create dropdown from csv file
---
css/dropdown.css | 1 +
index.html | 34 +++++-----------------------------
js/table.js | 31 ++++++++++++++++++++++++++++---
3 files changed, 34 insertions(+), 32 deletions(-)
diff --git a/css/dropdown.css b/css/dropdown.css
index 84db02b..7a85769 100644
--- a/css/dropdown.css
+++ b/css/dropdown.css
@@ -4,6 +4,7 @@ Source: https://stackoverflow.com/questions/19206919/how-to-create-checkbox-insi
.dropdown-check-list {
display: inline-block;
+ padding: 5px;
}
.dropdown-check-list .anchor {
diff --git a/index.html b/index.html
index c417e06..a666fff 100644
--- a/index.html
+++ b/index.html
@@ -12,6 +12,7 @@
+
@@ -62,40 +63,15 @@
sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules.
Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.
- At solmen va esser necessi far uniform grammatica, pronunciation e plu sommun paroles. jony_ipsum
-
-
-
+ At solmen va esser necessi far uniform grammatica, pronunciation e plu sommun paroles. jony_ipsum
+
+
diff --git a/js/table.js b/js/table.js
index 61afc15..8e283e8 100644
--- a/js/table.js
+++ b/js/table.js
@@ -22,7 +22,8 @@ function handleFile() {
}
function processData(csv) {
- var table = "";
+ var table = "";
+ var checkbox = "";
// split rows
var allTextLines = csv.split(/\r\n|\n/);
@@ -30,14 +31,26 @@ function processData(csv) {
// create table header
table += "";
+ // create checkbox content
+ checkbox += "Select Columns";
+ checkbox += "";
table += "
";
// create table content
@@ -55,9 +68,21 @@ function processData(csv) {
table += "";
}
- table += "
";
-
document.getElementById('t01').innerHTML = table;
+ document.getElementById('list1').innerHTML = checkbox;
+
+ // create callbacks for checkboxes
+ var checkList = document.getElementById('list1');
+ checkList.getElementsByClassName('anchor')[0].onclick = function (evt) {
+ if (!checkList.classList.contains('visible'))
+ checkList.classList.remove('visible');
+ else
+ checkList.classList.add('visible');
+ }
+
+ checkList.onblur = function (evt) {
+ checkList.classList.remove('visible');
+ }
}
function sortTable(n) {