Better sorting for files
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
// import { onMount } from 'svelte';
|
||||
// import { clipboard } from '@skeletonlabs/skeleton';
|
||||
import { liveQuery } from "dexie";
|
||||
|
||||
@@ -36,21 +36,17 @@ let dq__where_val: string = `for_type`;
|
||||
let dq__where_eq_val: string = link_to_type;
|
||||
let dq__where_for_id_eq_val: string = link_to_id;
|
||||
|
||||
|
||||
// This should only include files that are directly linked to 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)
|
||||
.and(file => file.for_id_random == dq__where_for_id_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>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user