mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
parent
410ac0c32f
commit
c2f89da4d1
2 changed files with 41 additions and 0 deletions
|
@ -1410,6 +1410,10 @@ Use `nonExpandableRowIds` to specify the ids for rows that should not be expanda
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|
||||||
|
### Expandable and selectable
|
||||||
|
|
||||||
|
<FileSource src="/framed/DataTable/DataTableExpandableSelectable" />
|
||||||
|
|
||||||
### Skeleton
|
### Skeleton
|
||||||
|
|
||||||
<DataTableSkeleton />
|
<DataTableSkeleton />
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
<script>
|
||||||
|
import { DataTable } from "carbon-components-svelte";
|
||||||
|
|
||||||
|
let expandedRowIds = [];
|
||||||
|
let selectedRowIds = [];
|
||||||
|
|
||||||
|
$: {
|
||||||
|
console.log("expandedRowIds", expandedRowIds);
|
||||||
|
console.log("selectedRowIds", selectedRowIds);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<DataTable
|
||||||
|
batchExpansion
|
||||||
|
batchSelection
|
||||||
|
bind:expandedRowIds
|
||||||
|
bind:selectedRowIds
|
||||||
|
headers="{[
|
||||||
|
{ key: 'name', value: 'Name' },
|
||||||
|
{ key: 'protocol', value: 'Protocol' },
|
||||||
|
{ 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',
|
||||||
|
}))}"
|
||||||
|
>
|
||||||
|
<svelte:fragment slot="expanded-row" let:row>
|
||||||
|
<pre>
|
||||||
|
{JSON.stringify(row, null, 2)}
|
||||||
|
</pre>
|
||||||
|
</svelte:fragment>
|
||||||
|
</DataTable>
|
Loading…
Add table
Add a link
Reference in a new issue