addFlatten
addFlatten flattens the table by removing parent rows and bringing subrows up.
Options
Information:
Options passed into
addFlatten.const table = createTable(data, {
flatten: addFlatten({ ... }),
});const table = createTable(data, {
flatten: addFlatten({ ... }),
});initialDepth?: number
How many levels to flatten. Default 0.
Column Options
Information:
Options passed into column definitions.
const columns = table.createColumns([
table.column({
header: 'Name',
accessor: 'name',
plugins: {
flatten: { ... },
},
}),
]);const columns = table.createColumns([
table.column({
header: 'Name',
accessor: 'name',
plugins: {
flatten: { ... },
},
}),
]);Prop Set
Information:
Extensions to the view model. Subscribe to
.props().{#each $headerRows as headerRow (headerRow.id)}
<Subscribe rowProps={headerRow.props()} let:rowProps>
{rowProps.flatten}
{#each headerRow.cells as cell (cell.id)}
<Subscribe props={cell.props()} let:props>
{props.flatten}
</Subscribe>
{/each}
</Subscribe>
{/each}{#each $headerRows as headerRow (headerRow.id)}
<Subscribe rowProps={headerRow.props()} let:rowProps>
{rowProps.flatten}
{#each headerRow.cells as cell (cell.id)}
<Subscribe props={cell.props()} let:props>
{props.flatten}
</Subscribe>
{/each}
</Subscribe>
{/each}BodyCell props
flatten(depth: number): voidunflatten(): void
Plugin State
Information:
State provided by
addFlatten.const { headerRows, rows, pluginStates } = table.createViewModel(columns);
const { ... } = pluginStates.flatten;const { headerRows, rows, pluginStates } = table.createViewModel(columns);
const { ... } = pluginStates.flatten;depth: Writable<number>
Current flatten depth.