diff --git a/application/controllers/Bandmap.php b/application/controllers/Bandmap.php index e98d7470..e600e365 100644 --- a/application/controllers/Bandmap.php +++ b/application/controllers/Bandmap.php @@ -36,7 +36,7 @@ class Bandmap extends CI_Controller { $footerData = []; $footerData['scripts'] = [ 'assets/js/moment.min.js', - 'assets/js/datetime-moment.js', + 'assets/js/datetime-moment.js', 'assets/js/sections/bandmap_list.js' ]; diff --git a/application/views/bandmap/list.php b/application/views/bandmap/list.php index e742863a..a193a5ac 100644 --- a/application/views/bandmap/list.php +++ b/application/views/bandmap/list.php @@ -4,6 +4,15 @@ var custom_date_format = ""; + +

diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index 2129fbe5..75deb82f 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -15,29 +15,48 @@ $(function() { dataType: "json" }).done(function(dxspots) { var table = $('.spottable').DataTable(); - table.clear(); table.page.len(50); - table.order([1, 'asc']); + let oldtable=table.data(); + table.clear(); if (dxspots.length>0) { dxspots.sort(SortByQrg); dxspots.forEach((single) => { - // var data = [[ single.when_pretty, single.frequency, single.spotted, single.dxcc_spotted.call ]]; var data=[]; data[0]=[]; data[0].push(single.when_pretty); data[0].push(single.frequency); data[0].push((single.worked_call ?'' : '')+single.spotted+(single.worked_call ? '' : '')); data[0].push(single.dxcc_spotted.entity); - table.rows.add(data).draw(); - // add to datatable single + if (oldtable.length > 0) { + let update=false; + oldtable.each( function (srow) { + if (JSON.stringify(srow) === JSON.stringify(data[0])) { + update=true; + } + }); + if (!update) { // Sth. Fresh? So highlight + table.rows.add(data).draw().nodes().to$().addClass("fresh bg-info"); + } else { + table.rows.add(data).draw(); + } + } else { + table.rows.add(data).draw(); + } }); + setTimeout(function(){ // Remove Highlights within 15sec + $(".fresh").removeClass("bg-info"); + },1000); } }); } + $('.spottable').DataTable().order([1, 'asc']); + $('.spottable').DataTable().clear(); fill_list($('#band option:selected').val(),30); setInterval(function () { fill_list($('#band option:selected').val(),30); },60000); $("#band").on("change",function() { + $('.spottable').DataTable().order([1, 'asc']); + $('.spottable').DataTable().clear(); fill_list($('#band option:selected').val(),30); });