diff --git a/summary/99_footer.html b/summary/99_footer.html index 9e76c6d..7355b41 100644 --- a/summary/99_footer.html +++ b/summary/99_footer.html @@ -41,7 +41,20 @@ }); }; - // permet de trier le tableau + // alignement à droit des colonnes numériques + const alignNumericCells = () => { + const rows = document.querySelectorAll('table tr:nth-child(n+2)'); + rows.forEach(row => { + Array.from(row.children).forEach(cell => { + const value = parseFloat(cell.innerText.replace(',', '.')); // gérer les virgules si jamais + if (!isNaN(value)) { + cell.classList.add('numeric'); + } + }); + }); + }; + + // permet de trier le tableau document.querySelectorAll('table th').forEach(th => { th.addEventListener('click', () => { const table = th.closest('table'); @@ -55,9 +68,10 @@ rows.sort(comparer(index, asc)).forEach(row => tbody.appendChild(row)); }); }); - + // Appliquer la colorisation après chargement du tableau colorizeCells(); + alignNumericCells(); });