add header to base yml file for column selection

This commit is contained in:
Wolfgang 2024-05-24 19:23:31 +02:00
parent 87ce5c1a8e
commit 401b52b768
2 changed files with 62 additions and 48 deletions

View file

@ -1,3 +1,5 @@
- band: header
columns: [band, frequency, mode, bandwidth, description]
- band: 2.2 km
mode: CW
bandwidth: 200

View file

@ -90,17 +90,28 @@ div#togglebuttons>button {
function update_table(bands, additions) {
var tdata = [];
var header = {};
// first, fill header
bands.forEach((band) => {
if (band.band === "header") {
header = structuredClone(band);
}
});
// then fill tdata
bands.forEach((band) => {
if (band.band !== "header") {
band.parts.forEach((part) => {
let p = {
"band": band.band,
"frequency": typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end,
"mode": band.mode,
//"band_start": band.start,
//"band_end": band.end,
"bandwidth": band.bandwidth,
"description": part.description,
};
let p = {};
header.columns.forEach((col) => {
p[col] = band[col];
if (col == "description") {
p[col] = part[col];
}
});
p["frequency"] = typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end;
let parts_already_added = false;
additions.forEach((add) => {
if (typeof part.at !== "undefined") {
@ -145,6 +156,7 @@ div#togglebuttons>button {
}
parts_already_added = false;
});
}
});
// require in tabular-tables