0
0
Fork 0

Sort entry observation options

This commit is contained in:
William Buezas 2024-02-05 12:04:28 -03:00
parent cde41ab337
commit 28790705ea
1 changed files with 7 additions and 1 deletions

View File

@ -15,6 +15,12 @@ const { t } = useI18n();
const entryObservationsRef = ref(null); const entryObservationsRef = ref(null);
const entryObservationsOptions = ref([]); const entryObservationsOptions = ref([]);
const sortEntryObservationOptions = (data) => {
entryObservationsOptions.value = [...data].sort((a, b) =>
a.description.localeCompare(b.description)
);
};
onMounted(() => { onMounted(() => {
if (entryObservationsRef.value) entryObservationsRef.value.reload(); if (entryObservationsRef.value) entryObservationsRef.value.reload();
}); });
@ -22,7 +28,7 @@ onMounted(() => {
<template> <template>
<FetchData <FetchData
url="ObservationTypes" url="ObservationTypes"
@on-fetch="(data) => (entryObservationsOptions = data)" @on-fetch="(data) => sortEntryObservationOptions(data)"
auto-load auto-load
/> />
<CrudModel <CrudModel