diff --git a/app/Views/incomingSilicaSandDetails.php b/app/Views/incomingSilicaSandDetails.php index f276108b..57c1668f 100644 --- a/app/Views/incomingSilicaSandDetails.php +++ b/app/Views/incomingSilicaSandDetails.php @@ -1695,7 +1695,21 @@ $(document).ready(function() { function exportTableToExcel(tableID, filename = '') { let table = document.getElementById(tableID); - let rows = table.rows; + let cloneTable = table.cloneNode(true); // Clone the table to modify + + // Remove hidden rows + $(cloneTable).find('tr').filter(function () { + return $(this).css('display') === 'none'; + }).remove(); + + // Remove hidden columns + $(cloneTable).find('th, td').each(function () { + if ($(this).css('display') === 'none') { + $(this).remove(); + } + }); + + let rows = cloneTable.rows; let data = []; for (let i = 0; i < rows.length; i++) {