Fix CSV-Download at LBA

This commit is contained in:
int2001
2026-03-21 17:11:43 +00:00
parent 25bb2392a1
commit e16ddcfe47
2 changed files with 14 additions and 5 deletions

View File

@@ -906,6 +906,7 @@ $options = json_decode($options);
</div>
</form>
<div id="csv-button-container" class="mb-2"></div>
<table style="width:100%" class="table-sm table table-hover table-striped table-bordered table-condensed text-center" id="qsoList">
<thead>
<tr>

View File

@@ -206,6 +206,10 @@ function loadQSOTable(rows) {
// Prevent initializing if already a DataTable
if ($.fn.DataTable.isDataTable($table)) {
// Remove ALL buttons containers to prevent duplicates
$('#qsoList').prev('.dt-buttons').remove();
$('#qsoList_wrapper').find('.dt-buttons').remove();
$('.dt-buttons').remove();
$table.DataTable().clear().destroy();
}
@@ -232,14 +236,15 @@ function loadQSOTable(rows) {
{ targets: $(".antennaelevation-column-sort").index(), type: "numbersort" },
{ targets: $(".stationpower-column-sort").index(), type: "numbersort" },
],
dom: 'Bfrtip',
dom: 'frtip',
buttons: [
{
extend: 'csv',
className: 'mb-1 btn btn-sm btn-primary', // Bootstrap classes
init: function(api, node, config) {
$(node).removeClass('dt-button').addClass('btn btn-primary'); // Ensure Bootstrap class applies
},
text: 'CSV',
className: 'mb-1 btn btn-sm btn-primary',
filename: function() {
return 'qso_export_' + new Date().toISOString().slice(0,10);
},
exportOptions: {
columns: ':visible:not(:eq(0))', // export all visible except column 4
format: {
@@ -275,6 +280,9 @@ function loadQSOTable(rows) {
]
});
// Place buttons in custom container
table.buttons().container().appendTo('#csv-button-container');
for (i = 0; i < rows.length; i++) {
let qso = rows[i];