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. Read
current.props on table components. The lists below are generated from the plugin's TypeScript prop-set type, so they match the published package exactly.BodyCell props cell.current.props.flatten
flatten: (depth: number) => void- Function to set the flatten depth.
unflatten: () => void- Function to reset flattening (set depth to 0).
Plugin State
Information:
State provided by
addFlatten.const vm = table.createViewModel(columns)
const { pluginStates } = vm
const { depth } = pluginStates.flattenconst vm = table.createViewModel(columns)
const { pluginStates } = vm
const { depth } = pluginStates.flattendepth: Box<number>
Current flatten depth. Assign to change it: depth.current = 1.