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 += ""; + + // create dropdown elements + checkbox += "
  • "; + checkbox += ""; + checkbox += data[j]; + checkbox += "
  • "; } + checkbox += ""; table += ""; // create table content @@ -55,9 +68,21 @@ function processData(csv) { table += ""; } - table += "
    "; table += data[j]; 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) {