BodyCell

BodyCell represents the model of a <td> element in <tr>.

Usage

id: string

A constant id that uniquely identifies the body cell in the row.

current: { attrs: BodyCellAttributes; props: BodyCellProps }

The attributes and plugin props of the <td> element as plain reactive values. current.attrs is ready to spread onto the element; current.props holds each plugin’s props, keyed by plugin name. Both update in place as table and plugin state change. Reads outside a template or effect return the current value, and server rendering produces the same markup.

<td {...cell.current.attrs} class:matches={cell.current.props.tableFilter.matches}>
<td {...cell.current.attrs} class:matches={cell.current.props.tableFilter.matches}>
Information:
See also Plugin View Model Extensions. v7 removed the attrs() and props() store methods; see Migrating to v7.

render: () => RenderConfig

Returns the render configuration of the body cell. Pass into Render#of.

<tr>
    {#each row.cells as cell (cell.id)}
        <td {...cell.current.attrs}>
            <Render of={cell.render()} />
        </td>
    {/each}
</tr>
<tr>
    {#each row.cells as cell (cell.id)}
        <td {...cell.current.attrs}>
            <Render of={cell.render()} />
        </td>
    {/each}
</tr>

row: BodyRow

A reference to the BodyRow that contains this cell.

column: Column

A reference to the column that defines this cell. The variant of column depends on the variant of BodyCell.

rowColId: () => string

A constant string that uniquely identifies the body cell in the table.

dataRowColId: () => string

A constant string that uniquely identifies the data attribute of the body cell in the table.

isData: () => boolean

Returns true if the body cell is an instance of DataBodyCell.

isDisplay: () => boolean

Returns true if the body cell is an instance of DisplayBodyCell.

Variants

DataBodyCell

DataBodyCells represent cells which are backed by a data attribute on a data item from the data source.

value: unknown

The value of the data cell.

DisplayBodyCell

DisplayBodyCells represent cells which are not backed by any data attribute.