mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
docs(data-table): extract "Sortable with pagination" example into iframe (#1456)
This commit is contained in:
parent
3f8bedd9f9
commit
b6a62d2502
2 changed files with 36 additions and 76 deletions
34
docs/src/pages/framed/DataTable/DataTablePagination.svelte
Normal file
34
docs/src/pages/framed/DataTable/DataTablePagination.svelte
Normal file
|
@ -0,0 +1,34 @@
|
|||
<script>
|
||||
import { DataTable, Pagination } from "carbon-components-svelte";
|
||||
|
||||
let rows = Array.from({ length: 10 }).map((_, i) => ({
|
||||
id: i,
|
||||
name: "Load Balancer " + (i + 1),
|
||||
protocol: "HTTP",
|
||||
port: 3000 + i * 10,
|
||||
rule: i % 2 ? "Round robin" : "DNS delegation",
|
||||
}));
|
||||
let pageSize = 5;
|
||||
let page = 1;
|
||||
</script>
|
||||
|
||||
<DataTable
|
||||
sortable
|
||||
title="Load balancers"
|
||||
description="Your organization's active load balancers."
|
||||
headers="{[
|
||||
{ key: 'name', value: 'Name' },
|
||||
{ key: 'protocol', value: 'Protocol' },
|
||||
{ key: 'port', value: 'Port' },
|
||||
{ key: 'rule', value: 'Rule' },
|
||||
]}"
|
||||
pageSize="{pageSize}"
|
||||
page="{page}"
|
||||
rows="{rows}"
|
||||
/>
|
||||
<Pagination
|
||||
bind:pageSize
|
||||
bind:page
|
||||
totalItems="{rows.length}"
|
||||
pageSizeInputDisabled
|
||||
/>
|
Loading…
Add table
Add a link
Reference in a new issue