mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-16 18:44:47 +00:00
Fix bug where download CSV icon would disappear on web interface after refreshing table data
This commit is contained in:
@@ -269,13 +269,7 @@ function addTableElement(blenderId, csvData, filename) {
|
||||
},
|
||||
});
|
||||
|
||||
var downloadCsv = $('<a><i class="fa-solid fa-file-csv"></i></a>')
|
||||
.css("margin-left", "10px")
|
||||
.css("cursor", "pointer");
|
||||
tableTitle.append(downloadCsv);
|
||||
downloadCsv.on("click", function () {
|
||||
table.download("csv", "data.csv");
|
||||
});
|
||||
createDownloadIcon(blenderId);
|
||||
|
||||
table.on("rowSelected", function (row) {
|
||||
var index = row.getIndex(); // the guid of the object
|
||||
@@ -301,6 +295,18 @@ function addTableElement(blenderId, csvData, filename) {
|
||||
});
|
||||
}
|
||||
|
||||
function createDownloadIcon(blenderId) {
|
||||
const table = Tabulator.findTable("#table-" + blenderId)[0];
|
||||
const tableTitle = $("#title-" + blenderId);
|
||||
var downloadCsv = $('<a><i class="fa-solid fa-file-csv"></i></a>')
|
||||
.css("margin-left", "10px")
|
||||
.css("cursor", "pointer");
|
||||
tableTitle.append(downloadCsv);
|
||||
downloadCsv.on("click", function () {
|
||||
table.download("csv", "data.csv");
|
||||
});
|
||||
}
|
||||
|
||||
// Function to update table and filename
|
||||
function updateTableElement(blenderId, csvData, filename) {
|
||||
// check if the headers are the same
|
||||
@@ -329,6 +335,7 @@ function updateTableElement(blenderId, csvData, filename) {
|
||||
}
|
||||
}
|
||||
$("#title-" + blenderId).text(filename);
|
||||
createDownloadIcon(blenderId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user