add sorting
This commit is contained in:
parent
815a74d01c
commit
869c43b17a
2
index.js
2
index.js
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue