Better sorting for files

This commit is contained in:
Scott Idem
2024-09-23 15:29:23 -04:00
parent 36283a215b
commit 80b394f16b
3 changed files with 13 additions and 32 deletions

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import { onMount } from 'svelte';
// import { onMount } from 'svelte';
// import { clipboard } from '@skeletonlabs/skeleton';
import { liveQuery } from "dexie";
@@ -35,19 +35,16 @@ ae_tmp.show__direct_download = false;
let dq__where_val: string = `${link_to_type}_id_random`;
let dq__where_eq_val: string = link_to_id;
// This should include all files that are associated with an object (event, location, session, presenter, etc.)
// I am not sure why, but doing reverse() and then sortBy() seems to sort in descending order.
let lq__event_file_obj_li = liveQuery(
async () => await db_events.files
.where(dq__where_val)
.equals(dq__where_eq_val)
.toArray()
.reverse()
.sortBy('created_on')
// .toArray()
);
onMount(() => {
// console.log('Element - Manage Event File List');
// console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
$slct_trigger = 'load__event_file_obj_li';
});
</script>