feat: Sort models by name in ascending/descending order

Co-Authored-By: silentoplayz <50341825+silentoplayz@users.noreply.github.com>
This commit is contained in:
Timothy Jaeryang Baek
2025-02-26 23:12:46 -08:00
co-authored by silentoplayz
parent ddb30589e3
commit da8c42ee49
2 changed files with 64 additions and 10 deletions
@@ -21,14 +21,24 @@
modelIds = modelList;
};
onMount(() => {
sortable = Sortable.create(modelListElement, {
animation: 150,
onUpdate: async (event) => {
positionChangeHandler();
}
});
});
$: if (modelIds) {
init();
}
const init = () => {
if (sortable) {
sortable.destroy();
}
if (modelListElement) {
sortable = Sortable.create(modelListElement, {
animation: 150,
onUpdate: async (event) => {
positionChangeHandler();
}
});
}
};
</script>
{#if modelIds.length > 0}