ui/table_state.svelte.ts view source
1000 Maximum number of rows that can be fetched in a single page.
Reactive state for database table pagination and data fetching.
Extends Loadable to manage paginated table data with column metadata, row deletion, and derived pagination controls.
@example
const table = new TableState();
await table.fetch('accounts', 0, 50);
// pagination
if (table.has_next) table.go_next();
await table.fetch(table.table_name, table.offset, table.limit);
// deletion
const deleted = await table.delete_row(table.rows[0]);@example
<script lang="ts">
import {TableState} from '@fuzdev/fuz_app/ui/table_state.svelte.js';
const table = new TableState();
table.fetch('accounts');
</script>
{#if table.loading}
<p>loading…</p>
{:else if table.error}
<p>{table.error}</p>
{:else}
<p>showing {table.showing_start}–{table.showing_end} of {table.total}</p>
{/if}2 declarations
ui/table_state.svelte.ts view source
1000 Maximum number of rows that can be fetched in a single page.
ui/table_state.svelte.ts view source
table_nametype string
columnstype Array<ColumnInfo>
rowstype Array<Record<string, unknown>>
totaloffsetlimitprimary_keytype string | null
deletingtype string | null
delete_errortype string | null
showing_startshowing_endhas_prevhas_nextfetchtype (table_name: string, offset?: number, limit?: number): Promise<void>
table_namestringoffsetnumber0limitnumber100Promise<void>go_prevtype (): void
voidgo_nexttype (): void
voiddelete_rowtype (row: Record<string, unknown>): Promise<boolean>
rowRecord<string, unknown>Promise<boolean>