Don't rerender list/map if band is not populated

这个提交包含在:
int2001 2023-07-25 05:42:02 +00:00
父节点 5edab2e443
当前提交 3b4138990c
共有 2 个文件被更改,包括 49 次插入40 次删除

查看文件

@ -123,6 +123,7 @@ $(function() {
}
function update_chart(band,maxAgeMinutes) {
if ((band != '') && (band !== undefined)) {
let dxurl = dxcluster_provider + "/spots/" + band + "/" +maxAgeMinutes;
$.ajax({
url: dxurl,
@ -141,10 +142,12 @@ $(function() {
bandMapChart.series[0].setData(spots4chart);
bandMapChart.redraw();
});
}
}
function set_chart(band, de, maxAgeMinutes) {
if ((band != '') && (band !== undefined)) {
let dxurl = dxcluster_provider + "/spots/" + band + "/" +maxAgeMinutes + "/" + de;
$.ajax({
url: dxurl,
@ -161,6 +164,7 @@ $(function() {
}
bandMapChart=render_chart(band,spots4chart);
});
}
}
$("#menutoggle").on("click", function() {

查看文件

@ -8,47 +8,52 @@ $(function() {
function fill_list(band,de,maxAgeMinutes) {
let dxurl = dxcluster_provider + "/spots/" + band + "/" +maxAgeMinutes + "/" + de;
$.ajax({
url: dxurl,
cache: false,
dataType: "json"
}).done(function(dxspots) {
var table = $('.spottable').DataTable();
table.page.len(50);
let oldtable=table.data();
table.clear();
if (dxspots.length>0) {
dxspots.sort(SortByQrg);
dxspots.forEach((single) => {
var data=[];
data[0]=[];
data[0].push(single.when_pretty);
data[0].push(single.frequency + " kHz");
data[0].push((single.worked_call ?'<span class="text-success">' : '')+single.spotted+(single.worked_call ? '</span>' : ''));
data[0].push(single.dxcc_spotted.entity);
data[0].push(single.spotter);
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();
var table = $('.spottable').DataTable();
if ((band != '') && (band !== undefined)) {
let dxurl = dxcluster_provider + "/spots/" + band + "/" +maxAgeMinutes + "/" + de;
$.ajax({
url: dxurl,
cache: false,
dataType: "json"
}).done(function(dxspots) {
table.page.len(50);
let oldtable=table.data();
table.clear();
if (dxspots.length>0) {
dxspots.sort(SortByQrg);
dxspots.forEach((single) => {
var data=[];
data[0]=[];
data[0].push(single.when_pretty);
data[0].push(single.frequency + " kHz");
data[0].push((single.worked_call ?'<span class="text-success">' : '')+single.spotted+(single.worked_call ? '</span>' : ''));
data[0].push(single.dxcc_spotted.entity);
data[0].push(single.spotter);
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();
}
} else {
table.rows.add(data).draw();
}
});
setTimeout(function(){ // Remove Highlights within 15sec
$(".fresh").removeClass("bg-info");
},1000);
}
});
});
setTimeout(function(){ // Remove Highlights within 15sec
$(".fresh").removeClass("bg-info");
},1000);
}
});
} else {
table.clear();
table.draw();
}
}
function highlight_current_qrg(qrg) {