mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
test: add nested headers example
This commit is contained in:
parent
e49369ef02
commit
ed3a3956fb
1 changed files with 30 additions and 0 deletions
30
tests/DataTableNestedHeaders.test.svelte
Normal file
30
tests/DataTableNestedHeaders.test.svelte
Normal file
|
@ -0,0 +1,30 @@
|
|||
<script lang="ts">
|
||||
import { DataTable } from "../types";
|
||||
</script>
|
||||
|
||||
<DataTable
|
||||
headers="{[
|
||||
{ key: 'name', value: 'Name' },
|
||||
{ key: 'protocol', value: 'Protocol', width: '400px', minWidth: '40%' },
|
||||
{ key: 'port', value: 'Port' },
|
||||
{ key: 'rule.name', value: 'Rule', sort: false },
|
||||
]}"
|
||||
rows="{[
|
||||
{
|
||||
id: 'a',
|
||||
name: 'Load Balancer 3',
|
||||
protocol: 'HTTP',
|
||||
port: 3000,
|
||||
'rule.name': 'Round robin',
|
||||
},
|
||||
]}"
|
||||
>
|
||||
<span slot="cell" let:cell let:row>
|
||||
{cell.key === "rule.name"}
|
||||
{#if cell.key === "name"}
|
||||
{row.name} {row.id}
|
||||
{:else}
|
||||
{cell.value}
|
||||
{/if}
|
||||
</span>
|
||||
</DataTable>
|
Loading…
Add table
Add a link
Reference in a new issue