diff --git a/band-plan.html b/band-plan.html index 7172433..47bfd17 100644 --- a/band-plan.html +++ b/band-plan.html @@ -13,6 +13,9 @@ body>div { padding-bottom: 1em; } +div#togglebuttons>button { + margin: 0 0.1em; +} @@ -107,9 +110,17 @@ body>div { table.download("pdf", path.basename(document.getElementById('sel_plan').value, '.yml') + '.pdf', {}, download_range); }); //["band", "frequency", "bandwidth", "mode", "description"].forEach((col) => { - table.getColumns().forEach((col) => { - document.getElementById("toggle-" + col).addEventListener("click", () => { - table.toggleColumn(col); + table.on("tableBuilt", () => { + var div_togglebuttons = document.getElementById("togglebuttons"); + div_togglebuttons.innerHTML = "Toggle column:"; + table.getColumns().forEach((col) => { + let col_name = col.getField(); + let b = document.createElement("button"); + b.innerText = col_name; + b.addEventListener("click", () => { + table.toggleColumn(col_name); + }); + div_togglebuttons.appendChild(b); }); }); document.getElementById("error").innerText = ""; @@ -122,20 +133,14 @@ body>div {