From 974ad60bfa082762dd514fd384aa7ce2fbe7176e Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Sat, 24 Jan 2026 13:19:44 +0100
Subject: [PATCH] [DBTools] Added counts in the dropdown filtering
---
assets/js/sections/logbookadvanced.js | 71 +++++++++++++++++++++------
1 file changed, 56 insertions(+), 15 deletions(-)
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js
index 6914e08b0..2948daa53 100644
--- a/assets/js/sections/logbookadvanced.js
+++ b/assets/js/sections/logbookadvanced.js
@@ -2383,14 +2383,22 @@ function saveOptions() {
column.search(val ? val : '', true, false).draw();
});
- // Extract text from rendered cells to get actual displayed content
+ // Count occurrences of each unique value
+ var counts = {};
column.nodes().flatten().to$().each(function () {
var text = $(this).text().trim();
- if (text && !select.find('option[value="' + text + '"]').length) {
- select.append('');
+ if (text) {
+ counts[text] = (counts[text] || 0) + 1;
}
});
+ // Add options with counts
+ for (var text in counts) {
+ if (!select.find('option[value="' + text + '"]').length) {
+ select.append('');
+ }
+ }
+
// Sort options
select.find('option:not(:first)').sort(function(a, b) {
return a.text.localeCompare(b.text);
@@ -2446,14 +2454,22 @@ function saveOptions() {
column.search(val ? val : '', true, false).draw();
});
- // Extract text from rendered cells to get actual displayed content
+ // Count occurrences of each unique value
+ var counts = {};
column.nodes().flatten().to$().each(function () {
var text = $(this).text().trim();
- if (text && !select.find('option[value="' + text + '"]').length) {
- select.append('');
+ if (text) {
+ counts[text] = (counts[text] || 0) + 1;
}
});
+ // Add options with counts
+ for (var text in counts) {
+ if (!select.find('option[value="' + text + '"]').length) {
+ select.append('');
+ }
+ }
+
// Sort options
select.find('option:not(:first)').sort(function(a, b) {
return a.text.localeCompare(b.text);
@@ -2516,14 +2532,22 @@ function saveOptions() {
column.search(val ? val : '', true, false).draw();
});
- // Extract text from rendered cells to get actual displayed content
+ // Count occurrences of each unique value
+ var counts = {};
column.nodes().flatten().to$().each(function () {
var text = $(this).text().trim();
- if (text && !select.find('option[value="' + text + '"]').length) {
- select.append('');
+ if (text) {
+ counts[text] = (counts[text] || 0) + 1;
}
});
+ // Add options with counts
+ for (var text in counts) {
+ if (!select.find('option[value="' + text + '"]').length) {
+ select.append('');
+ }
+ }
+
// Sort options
select.find('option:not(:first)').sort(function(a, b) {
return a.text.localeCompare(b.text);
@@ -2650,6 +2674,7 @@ function saveOptions() {
id_list.forEach(function(id) {
let row = $("#dxccCheckTable tbody tr#qsoID-" + id);
table.row(row).remove();
+ $('#checkBoxAllDxcc').prop('checked', false);
});
table.draw(false);
$('.dxcctablediv').html(data.message);
@@ -2700,14 +2725,22 @@ function saveOptions() {
column.search(val ? val : '', true, false).draw();
});
- // Extract text from rendered cells to get actual displayed content
+ // Count occurrences of each unique value
+ var counts = {};
column.nodes().flatten().to$().each(function () {
var text = $(this).text().trim();
- if (text && !select.find('option[value="' + text + '"]').length) {
- select.append('');
+ if (text) {
+ counts[text] = (counts[text] || 0) + 1;
}
});
+ // Add options with counts
+ for (var text in counts) {
+ if (!select.find('option[value="' + text + '"]').length) {
+ select.append('');
+ }
+ }
+
// Sort options
select.find('option:not(:first)').sort(function(a, b) {
return a.text.localeCompare(b.text);
@@ -2877,18 +2910,26 @@ function saveOptions() {
column.search(val ? val : '', true, false).draw();
});
- // Extract text from rendered cells to get actual displayed content
+ // Count occurrences of each unique value
+ var counts = {};
column.nodes().flatten().to$().each(function () {
// Get text from the first anchor link which contains the IOTA reference
var $anchor = $(this).find('a').first();
var text = $anchor.length ? $anchor.text().trim() : $(this).text().trim();
// Remove any extra whitespace
text = text.split(/\s+/)[0];
- if (text && !select.find('option[value="' + text + '"]').length) {
- select.append('');
+ if (text) {
+ counts[text] = (counts[text] || 0) + 1;
}
});
+ // Add options with counts
+ for (var text in counts) {
+ if (!select.find('option[value="' + text + '"]').length) {
+ select.append('');
+ }
+ }
+
// Sort options
select.find('option:not(:first)').sort(function(a, b) {
return a.text.localeCompare(b.text);