add sorting

This commit is contained in:
zongor 2024-11-05 11:34:50 -05:00
parent 815a74d01c
commit 869c43b17a
1 changed files with 1 additions and 1 deletions

View File

@ -57,7 +57,7 @@
if (data.length > 0) { if (data.length > 0) {
let tableBody = document.getElementById('table-body'); let tableBody = document.getElementById('table-body');
tableBody.innerHTML = ''; tableBody.innerHTML = '';
data.forEach((row, index) => { data.sort((a, b) => b.votes - a.votes).forEach((row, index) => {
let rowElement = tableBody.insertRow(); let rowElement = tableBody.insertRow();
rowElement.setAttribute('class', `with-state-links row-${index} svelte-woitu6 first-poll-close-row`); rowElement.setAttribute('class', `with-state-links row-${index} svelte-woitu6 first-poll-close-row`);
let nameCell = rowElement.insertCell(); let nameCell = rowElement.insertCell();