diff --git a/packages/builder/src/components/database/DataTable/ModelDataTable.svelte b/packages/builder/src/components/database/DataTable/ModelDataTable.svelte index af99b2bada..0804b5e8da 100644 --- a/packages/builder/src/components/database/DataTable/ModelDataTable.svelte +++ b/packages/builder/src/components/database/DataTable/ModelDataTable.svelte @@ -36,14 +36,14 @@ } } - $: paginatedData = data - ? data.slice( + $: sort = $backendUiStore.sort + $: sorted = sort ? fsort(data)[sort.direction](sort.column) : data + $: paginatedData = sorted + ? sorted.slice( currentPage * ITEMS_PER_PAGE, currentPage * ITEMS_PER_PAGE + ITEMS_PER_PAGE ) : [] - $: sort = $backendUiStore.sort - $: sorted = sort ? fsort(data)[sort.direction](sort.column) : data $: headers = Object.keys($backendUiStore.selectedModel.schema) .sort() @@ -78,10 +78,10 @@
- {#if sorted.length === 0} + {#if paginatedData.length === 0}