//Tabulator Planelist var table = new Tabulator("#planelist", { layout:"fitColumns", placeholder:"No Data Set", height:"100%", rowFormatter:function(row){ row.getElement().classList.add("listType_" + row["_row"]["data"]["type"]); }, columns:[ {title:"Hex", field:"hex", sorter:"string"}, {title:"Reg", field:"registration", sorter:"string", sorterParams: { alignEmptyValues:"bottom" }}, {title:"Flight", field:"flight", sorter:"string", sorterParams: { alignEmptyValues:"bottom" }, widthGrow: 2 }, {title:"Alt", field:"altitude", sorter:"number", sorterParams: { alignEmptyValues:"bottom", thousandSeparator:".", decimalSeparator:"," }}, {title:"", field:"speed", sorter:"number"}, // {title:"", field:"track", sorter:"number"}, {title:"", field:"fix", sorter:"string",formatter:"html", maxWidth: 1}, ], initialSort:[ {column:"flight",dir:"asc"}, {column:"fix",dir:"asc"}, ], }); table.on( "rowClick", function(e, row){ planeSelect(row["_row"]["data"]["hex"]); } ); //Tabulator shiplist var shipsTable = new Tabulator("#shiplist", { layout:"fitColumns", placeholder:"No Data Set", height:"100%", rowFormatter:function(row){ row.getElement().classList.add("listType_" + row["_row"]["data"]["type"]); }, initialSort:[ {column:"name",dir:"asc"} ], columns:[ {title:"MMSI", field:"mmsi", sorter:"string", minWidth: 90}, {title:"Name", field:"name", sorter:"string", sorterParams: { alignEmptyValues:"bottom" }, widthGrow: 2}, {title:"Call", field:"callsign", sorter:"string", sorterParams: { alignEmptyValues:"bottom" }}, //{title:"Speed", field:"speed", sorter:"number"}, {title:"", field:"fix", sorter:"string",formatter:"html", maxWidth: 1}, ], }); shipsTable.on( "rowClick", function(e, row){ shipSelect(row["_row"]["data"]["mmsi"]); } ); //Tabulator PlaneHistoryList var planesHistoryTable = new Tabulator("#planeHistoryList", { layout:"fitDataStretch", placeholder:"Loading...", height:"100%", initialSort:[ {column:"flight",dir:"asc"} ], columns:[ {title:"Hex", field:"hex", sorter:"string"}, {title:"Reg", field:"registration", sorter:"string", sorterParams: { alignEmptyValues:"bottom" }}, {title:"Flight", field:"flight", sorter:"string", sorterParams: { alignEmptyValues:"bottom" }}, {title:"Seen", field:"seen", sorter:"string"}, ], }); planesHistoryTable.on( "rowClick", function(e, row){ planeSelect(row["_row"]["data"]["hex"], true); } ); function zeroFormatter(cell) { if(typeof cell.getValue() === "undefined") { return "0"; } else { return cell.getValue(); } } //Tabulator stationlist var stationTable = new Tabulator("#stationlist", { layout:"fitColumns", placeholder:"No Data Set", height:"100%", //ajaxURL:"data/station.json", initialSort:[ {column:"name",dir:"asc"} ], columns:[ {title:"Station", field:"name", sorter:"string", widthGrow: 5}, {title:"", field:"adsb.total", sorter:"number", sorterParams: { alignEmptyValues:"bottom" }, headerSortStartingDir:"desc", formatter: (cell) => this.zeroFormatter(cell), hozAlign:"right" }, //{title:"", field:"adsb.total_fix", sorter:"number", sorterParams: { alignEmptyValues:"bottom" }, headerSortStartingDir:"desc", formatter: (cell) => this.zeroFormatter(cell), hozAlign:"right"}, //{title:"", field:"adsb.total_mlat", sorter:"number", sorterParams: { alignEmptyValues:"bottom" }, headerSortStartingDir:"desc", formatter: (cell) => this.zeroFormatter(cell), hozAlign:"right"}, {title:"", field:"ais.total", sorter:"number", sorterParams: { alignEmptyValues:"bottom" }, headerSortStartingDir:"desc", formatter: (cell) => this.zeroFormatter(cell), hozAlign:"right"}, {title:"", field:"radiosondes.total", sorter:"number", sorterParams: { alignEmptyValues:"bottom" }, headerSortStartingDir:"desc", formatter: (cell) => this.zeroFormatter(cell), hozAlign:"right"}, {title:"", field:"seen", sorter:"string", formatter:"html", maxWidth: 1, hozAlign:"right"}, ], }); stationTable.on( "rowClick", function(e, row){ stationSelect(row["_row"]["data"]["name"]); } ); //Eigene Dynamische Tabellenlogik //hier könnte man das array sortieren nach festgelegtem sorter function radiosondeListTableRefresh(){ var tableBody = 'radiosondeListTableBody'; var tableSorter = 'altitude'; var tableSorterDirection = 'asc'; //sort if(tableSorterDirection!='desc'){ radiosondeListTableData.sort((a,b) => { return a[tableSorter] - b[tableSorter]; }); } else{ radiosondeListTableData.sort((a,b) => { return b[tableSorter] - a[tableSorter]; }); } document.getElementById(tableBody).innerHTML=''; Object.values(radiosondeListTableData).forEach( function tableRows(r){ var trclass = ""; if(typeof r.launchsite?.type !== "undefined"){ var trclass = 'tr_' + r.launchsite.type; } document.getElementById(tableBody).innerHTML+='