fix pagination next prev

This commit is contained in:
Philipp Dormann 2023-04-12 15:51:46 +02:00
parent 238082b657
commit cac851f2b1
Signed by: philipp
GPG Key ID: 3BB9ADD52DCA4314

View File

@ -215,28 +215,28 @@
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<button <button
class="border rounded p-1" class="border rounded p-1"
onClick={() => $table.setPageIndex(0)} on:click={() => $table.setPageIndex(0)}
disabled={!$table.getCanPreviousPage()} disabled={!$table.getCanPreviousPage()}
> >
{"<<"} {"<<"}
</button> </button>
<button <button
class="border rounded p-1" class="border rounded p-1"
onClick={() => $table.previousPage()} on:click={() => $table.previousPage()}
disabled={!$table.getCanPreviousPage()} disabled={!$table.getCanPreviousPage()}
> >
{"<"} {"<"}
</button> </button>
<button <button
class="border rounded p-1" class="border rounded p-1"
onClick={() => $table.nextPage()} on:click={() => $table.nextPage()}
disabled={!$table.getCanNextPage()} disabled={!$table.getCanNextPage()}
> >
{">"} {">"}
</button> </button>
<button <button
class="border rounded p-1" class="border rounded p-1"
onClick={() => $table.setPageIndex($table.getPageCount() - 1)} on:click={() => $table.setPageIndex($table.getPageCount() - 1)}
disabled={!$table.getCanNextPage()} disabled={!$table.getCanNextPage()}
> >
{">>"} {">>"}
@ -253,7 +253,7 @@
<input <input
type="number" type="number"
defaultValue={$table.getState().pagination.pageIndex + 1} defaultValue={$table.getState().pagination.pageIndex + 1}
onChange={(e) => { on:change={(e) => {
const page = e.target.value ? Number(e.target.value) - 1 : 0; const page = e.target.value ? Number(e.target.value) - 1 : 0;
$table.setPageIndex(page); $table.setPageIndex(page);
}} }}