TableState
TableState is what labels (header, cell, footer, a display column’s data) receive as their second argument, and what plugins receive as tableState. Its reactive members are getters: call them inside the label’s returned getter, a component, a $derived or a template so the read is tracked.
table.column({
accessor: 'name',
header: (_cell, state) => () => `Name (${state.pageRows().length} on page)`
})table.column({
accessor: 'name',
header: (_cell, state) => () => `Name (${state.pageRows().length} on page)`
})$pageRows); in v7 they are functions. A label that returns a getter re-renders when what it reads changes, because <Render> calls the getter inside the template.Usage
data: () => Item[]
Returns the table’s data array: the array you passed to createTable, or the result of the getter you passed.
columns: Column[]
The column definitions of the table.
flatColumns: FlatColumn[]
Every flat column, before plugin transformations. A plain array.
tableAttrs: () => TableAttributes
tableHeadAttrs: () => TableHeadAttributes
tableBodyAttrs: () => TableBodyAttributes
Return the finalized attributes for <table>, <thead> and <tbody>.
visibleColumns: () => FlatColumn[]
Returns the columns left after plugin transformations.
headerRows: () => HeaderRow[]
Returns the header rows.
originalRows: () => BodyRow[]
Returns the rows built from the data, before plugin transformations.
rows: () => BodyRow[]
Returns every row after plugin transformations.
pageRows: () => BodyRow[]
Returns the rows of the current page.
pluginStates: PluginStates
The same object as TableViewModel#pluginStates. Only labels receive it; plugins get the other members.