Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(data-table): extract "Sortable with pagination" example into ifr…
…ame (#1456)
- Loading branch information
Showing
2 changed files
with
36 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
docs/src/pages/framed/DataTable/DataTablePagination.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
/> |