diff --git a/ome2024-ngff-challenge/src/App.svelte b/ome2024-ngff-challenge/src/App.svelte index 94373cb..5719419 100644 --- a/ome2024-ngff-challenge/src/App.svelte +++ b/ome2024-ngff-challenge/src/App.svelte @@ -73,16 +73,18 @@ } let sortedBy = ""; - let sortAscending = true; - function handleSort(colname) { - if (sortedBy === colname) { - sortAscending = !sortAscending; + let sortAscending = false; + function toggleSortAscending() { + sortAscending = !sortAscending; + ngffTable.sortTable(sortedBy, sortAscending); + } + function handleSort(event) { + sortedBy = event.target.value; + if (sortedBy === "") { + ngffTable.sortTable("index", true); } else { - // start by sorting descending (biggest first) - sortAscending = false; + ngffTable.sortTable(sortedBy, sortAscending); } - sortedBy = colname; - ngffTable.sortTable(colname, sortAscending); } // Main filtering function @@ -318,74 +320,29 @@
- - Sort by: -