automatically add all columns
This commit is contained in:
parent
37e847990f
commit
e98837082e
|
@ -88,31 +88,18 @@ 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) => {
|
||||||
band.parts.forEach((part) => {
|
band.parts.forEach((part) => {
|
||||||
let p = {
|
let p = {
|
||||||
"band": band.band,
|
"band": band.band,
|
||||||
|
"frequency": typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end,
|
||||||
"mode": band.mode,
|
"mode": band.mode,
|
||||||
//"band_start": band.start,
|
//"band_start": band.start,
|
||||||
//"band_end": band.end,
|
//"band_end": band.end,
|
||||||
"bandwidth": band.bandwidth,
|
"bandwidth": band.bandwidth,
|
||||||
"description": part.description,
|
"description": part.description,
|
||||||
"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,26 @@ 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) => {
|
||||||
}},
|
if (column.field == "band") {
|
||||||
{title: "frequency/kHz", field: "frequency", sorter: "number", headerFilter: "input", headerFilterFunc: filter_with_not},
|
column.sorter = function(a, b, aRow, bRow, column, dir, sorterParams) {
|
||||||
{title: "bandwidth/Hz", field: "bandwidth", headerFilter: "input", headerFilterFunc: filter_with_not},
|
return parseFloat(new Measures().from(a).to('m')) - parseFloat(new Measures().from(b).to('m'));
|
||||||
{title: "mode", field: "mode", headerFilter: "input", headerFilterFunc: filter_with_not},
|
}
|
||||||
//{title: "band_start", field: "band_start", headerFilter: "input"},
|
}
|
||||||
//{title: "band_end", field: "band_end", headerFilter: "input"},
|
|
||||||
{title: "description", field: "description", headerFilter: "input", headerFilterFunc: filter_with_not},
|
if (column.field == "frequency") {
|
||||||
{title: "power_a", field: "power_a", headerFilter: "input", headerFilterFunc: filter_with_not},
|
column.sorter = "number";
|
||||||
{title: "power_e", field: "power_e", headerFilter: "input", headerFilterFunc: filter_with_not},
|
}
|
||||||
{title: "power_n", field: "power_n", headerFilter: "input", headerFilterFunc: filter_with_not},
|
|
||||||
],
|
column.headerFilter = "input";
|
||||||
|
column.headerFilterFunc = filter_with_not;
|
||||||
|
});
|
||||||
|
|
||||||
|
return definitions;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("download").addEventListener("click", () => {
|
document.getElementById("download").addEventListener("click", () => {
|
||||||
|
|
Loading…
Reference in a new issue