automatically add all columns

This commit is contained in:
Wolfgang 2024-05-23 18:00:11 +02:00
parent 37e847990f
commit 10586e3abf

View file

@ -88,16 +88,6 @@ div#togglebuttons>button {
} }
} }
function debug_tdata(s, tdata) {
if (tdata.length > 0) {
console.log(s + " " + tdata.length + " " + tdata[tdata.length - 1].frequency + " " + tdata[tdata.length - 1].power_a);
//console.log(s + " " + tdata.length);
//tdata.forEach((t) => {
// console.log(s + " " + t.frequency);
//});
}
}
function update_table(bands, additions) { function update_table(bands, additions) {
var tdata = []; var tdata = [];
bands.forEach((band) => { bands.forEach((band) => {
@ -110,9 +100,6 @@ div#togglebuttons>button {
"bandwidth": band.bandwidth, "bandwidth": band.bandwidth,
"description": part.description, "description": part.description,
"frequency": typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end, "frequency": typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end,
//"at": part.at,
//"start": part.start,
//"end": part.end,
}; };
let parts_already_added = false; let parts_already_added = false;
additions.forEach((add) => { additions.forEach((add) => {
@ -170,21 +157,16 @@ div#togglebuttons>button {
], ],
selectableRows: true, selectableRows: true,
data: tdata, data: tdata,
columns: [ autoColumns:"full",
// eslint-disable-next-line no-unused-vars // add filter for all columns
{title: "band", field: "band", headerFilter: "input", sorter: function(a, b, aRow, bRow, column, dir, sorterParams){ autoColumnsDefinitions: function(definitions){
return parseFloat(new Measures().from(a).to('m')) - parseFloat(new Measures().from(b).to('m')); definitions.forEach((column) => {
}}, column.headerFilter = "input";
{title: "frequency/kHz", field: "frequency", sorter: "number", headerFilter: "input", headerFilterFunc: filter_with_not}, column.headerFilterFunc = filter_with_not;
{title: "bandwidth/Hz", field: "bandwidth", headerFilter: "input", headerFilterFunc: filter_with_not}, });
{title: "mode", field: "mode", headerFilter: "input", headerFilterFunc: filter_with_not},
//{title: "band_start", field: "band_start", headerFilter: "input"}, return definitions;
//{title: "band_end", field: "band_end", headerFilter: "input"}, },
{title: "description", field: "description", headerFilter: "input", headerFilterFunc: filter_with_not},
{title: "power_a", field: "power_a", headerFilter: "input", headerFilterFunc: filter_with_not},
{title: "power_e", field: "power_e", headerFilter: "input", headerFilterFunc: filter_with_not},
{title: "power_n", field: "power_n", headerFilter: "input", headerFilterFunc: filter_with_not},
],
}); });
document.getElementById("download").addEventListener("click", () => { document.getElementById("download").addEventListener("click", () => {