header in both plans, add title mapping to columns
This commit is contained in:
parent
603bd72bbb
commit
c142be9e4a
|
@ -1,3 +1,10 @@
|
||||||
|
- header: true
|
||||||
|
columns: [power]
|
||||||
|
titles: {
|
||||||
|
power_a: Power A,
|
||||||
|
power_e: Power E,
|
||||||
|
power_n: Power N
|
||||||
|
}
|
||||||
- start: 135.7
|
- start: 135.7
|
||||||
end: 137.8
|
end: 137.8
|
||||||
power: {a: 1 W ERP}
|
power: {a: 1 W ERP}
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
- band: header
|
- header: true
|
||||||
columns: [band, frequency, mode, bandwidth, description]
|
columns: [band, frequency, mode, bandwidth, description]
|
||||||
|
part_columns: [description]
|
||||||
|
titles: {
|
||||||
|
band: Band,
|
||||||
|
frequency: Frequency / kHz,
|
||||||
|
mode: Mode,
|
||||||
|
bandwidth: Bandwidth / Hz,
|
||||||
|
description: Description
|
||||||
|
}
|
||||||
- band: 2.2 km
|
- band: 2.2 km
|
||||||
mode: CW
|
mode: CW
|
||||||
bandwidth: 200
|
bandwidth: 200
|
||||||
|
|
|
@ -84,30 +84,41 @@ div#togglebuttons>button {
|
||||||
|
|
||||||
function update_table(bands, additions) {
|
function update_table(bands, additions) {
|
||||||
var tdata = [];
|
var tdata = [];
|
||||||
var header = {};
|
var base_header = {};
|
||||||
|
var add_header = {};
|
||||||
|
|
||||||
// first, fill header
|
// first, fill base_header
|
||||||
bands.forEach((band) => {
|
bands.forEach((band) => {
|
||||||
if (band.band === "header") {
|
if ((typeof band.header !== "undefined") && band.header) {
|
||||||
header = structuredClone(band);
|
base_header = structuredClone(band);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// then fill tdata
|
// then fill tdata
|
||||||
bands.forEach((band) => {
|
bands.forEach((band) => {
|
||||||
if (band.band !== "header") {
|
if ((typeof band.header === "undefined") || (band.header == false)) {
|
||||||
band.parts.forEach((part) => {
|
band.parts.forEach((part) => {
|
||||||
let p = {};
|
let p = {};
|
||||||
header.columns.forEach((col) => {
|
base_header.columns.forEach((col) => {
|
||||||
p[col] = band[col];
|
if (base_header.part_columns.includes(col)) {
|
||||||
if (col == "description") {
|
|
||||||
p[col] = part[col];
|
p[col] = part[col];
|
||||||
|
} else {
|
||||||
|
p[col] = band[col];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
p["frequency"] = typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end;
|
p["frequency"] = typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end;
|
||||||
|
|
||||||
|
// first, fill add_header
|
||||||
|
additions.forEach((add) => {
|
||||||
|
if ((typeof add.header !== "undefined") && add.header) {
|
||||||
|
add_header = structuredClone(add);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// then fill tdata
|
||||||
let parts_already_added = false;
|
let parts_already_added = false;
|
||||||
additions.forEach((add) => {
|
additions.forEach((add) => {
|
||||||
|
if ((typeof add.header === "undefined") || (add.header == false)) {
|
||||||
if (typeof part.at !== "undefined") {
|
if (typeof part.at !== "undefined") {
|
||||||
if (isInRange(part.at, add.start, add.end)) {
|
if (isInRange(part.at, add.start, add.end)) {
|
||||||
// at single frequency
|
// at single frequency
|
||||||
|
@ -144,6 +155,7 @@ div#togglebuttons>button {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (!parts_already_added) {
|
if (!parts_already_added) {
|
||||||
tdata.push(p);
|
tdata.push(p);
|
||||||
|
@ -179,6 +191,12 @@ div#togglebuttons>button {
|
||||||
|
|
||||||
column.headerFilter = "input";
|
column.headerFilter = "input";
|
||||||
column.headerFilterFunc = filter_with_not;
|
column.headerFilterFunc = filter_with_not;
|
||||||
|
if (typeof base_header.titles[column.field] !== "undefined") {
|
||||||
|
column.title = base_header.titles[column.field];
|
||||||
|
}
|
||||||
|
if (typeof add_header.titles[column.field] !== "undefined") {
|
||||||
|
column.title = add_header.titles[column.field];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return definitions;
|
return definitions;
|
||||||
|
|
Loading…
Reference in a new issue