mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
docs(data-table): rework "Batch selection with initial selected rows" example
This commit is contained in:
parent
ae6330d7dd
commit
35985097da
1 changed files with 24 additions and 0 deletions
|
@ -0,0 +1,24 @@
|
|||
<script>
|
||||
import { DataTable } from "carbon-components-svelte";
|
||||
|
||||
let selectedRowIds = [2, 4];
|
||||
|
||||
$: console.log("selectedRowIds", selectedRowIds);
|
||||
</script>
|
||||
|
||||
<DataTable
|
||||
batchSelection
|
||||
bind:selectedRowIds
|
||||
headers="{[
|
||||
{ key: 'name', value: 'Name' },
|
||||
{ key: 'port', value: 'Port' },
|
||||
{ key: 'rule', value: 'Rule' },
|
||||
]}"
|
||||
rows="{Array.from({ length: 6 }).map((_, i) => ({
|
||||
id: i,
|
||||
name: 'Load Balancer ' + (i + 1),
|
||||
protocol: 'HTTP',
|
||||
port: i % 3 ? (i % 2 ? 3000 : 80) : 443,
|
||||
rule: i % 3 ? 'Round robin' : 'DNS delegation',
|
||||
}))}"
|
||||
/>
|
Loading…
Add table
Add a link
Reference in a new issue