• Reference
  • Nodes
  • Components
  • Data Table

Data Table Component

Data tables are powerful ways to display tabular data, like what you find in a CSV or SQL database.

Override the data property with the row-formatted data source (an array of objects with consistent keys). Often, this data is the result of a function (e.g. {{pgQuery1.data}}).

Data tables come batteries-included with support for:

  • Column controls (renaming, formatting, filtering, sorting)
  • Infinite scroll and pagination
  • Row selection / auto-advance
  • Downloading the underlying data (coming soon)
  • Custom cells (coming soon)

All data tables are virtualized and therefore remain performant when scrolling through large numbers of rows.

Properties

Visible

PropisVisible
Typeboolean
Defaulttrue

Whether or not this node is visible.

Enabled

PropisEnabled
Typeboolean
Defaulttrue

Whether or not this node is enabled.

Tooltip

Proptooltip
Typestring
Defaultundefined

The tooltip text to display when hovered or focused over this node.

Top

Proptop
Typenumber
Default1

The position of the node from the top side of the grid (grid-row-start).

Left

Propleft
Typenumber
Default1

The position of the node from the left side of the grid (grid-column-start).

Width

Propwidth
Typestring
Default640px

The width of the node. When this node is in a grid layout, this should be done using unitless grid column units (specifying 4 will become grid-column-end: span 4). When this node is in a stack layout, the width can be specified using CSS units (e.g. 100px or 100%), or be left unitless to be treated as flex-grow for the node.

Min Width

PropminWidth
Typestring
Defaultundefined

The minimum width of the node. When this node is in a grid layout, this property is ignored.

Max Width

PropmaxWidth
Typestring
Defaultundefined

The maximum width of the node. When this node is in a grid layout, this property is ignored.

Height

Propheight
Typestring
Default480px

The height of the node. When this node is in a grid layout, this should be done using unitless grid row units (specifying 4 will become grid-row-end: span 4). When this node is in a stack layout, the height can be specified using CSS units (e.g. 100px or 100%), or be left unitless to be treated as flex-grow for the node.

Min Height

PropminHeight
Typestring
Defaultundefined

The minimum height of the node. When this node is in a grid layout, this property is ignored.

Max Height

PropmaxHeight
Typestring
Defaultundefined

The minimum height of the node. When this node is in a grid layout, this property is ignored.

Overflow

Propoverflow
TypeOverflow ('auto' | 'visible' | 'hidden' | 'scroll')
Defaultauto

The strategy used to handle overflow in the horizontal and vertical axes for content that is larger than its container.

Overflow X

PropoverflowX
TypeOverflow ('auto' | 'visible' | 'hidden' | 'scroll')
Defaultauto

The strategy used to handle overflow in the horizontal axis for content that is larger than its container.

Overflow Y

PropoverflowY
TypeOverflow ('auto' | 'visible' | 'hidden' | 'scroll')
Defaultauto

The strategy used to handle overflow in the vertical axis for content that is larger than its container.

Custom Styles

Propstyles
Typestring
Default::component { } ::wrapper { }

Custom CSS styles to be applied to the node. Use element.styles to refer to the current node.

Object Fit

PropobjectFit
TypeObjectFit ('none' | 'contain' | 'cover' | 'fill' | 'scale-down')
Defaultcover

The strategy used to set how the content of a replaced element should be resized to fit its container.

Data Source

Propdata
Typeunknown
Default[ { email: 'alovelace@example.io', joined: '2021-01-03', verified: true, }, { email: 'aturing@example.io', joined: '2021-03-02', verified: false, }, ]

The table data in row-wise format. An array of objects with consistent keys, this is often the result of a function (e.g. {{pgQuery1.data}}).

Auto Columns

PropautoColumns
Typeboolean
Defaulttrue

Auto generate columns when data changes

Columns

Propcolumns
Typearray
Default[]

The column configuration for the data table.

Column Configuration

Propcolumns[]
Typeobject
Defaultundefined

Options for each column

Column Header

Propcolumns[].header
Typestring
Defaultundefined

The text to show at the top of the column

Key

Propcolumns[].accessor
Typestring
Defaultundefined

The property in the data to read for this column

ID

Propcolumns[].id
Typestring
Defaultundefined

A unique ID for this column

Width

Propcolumns[].width
Typenumber
Defaultundefined

The desired width for the column

Min Width

Propcolumns[].minWidth
Typenumber
Defaultundefined

The minimum width in px

Render As

Propcolumns[].renderAs
TypeColumnRenderingMethod ('default' | 'date' | 'time' | 'datetime' | 'boolean' | 'json' | 'raw' | 'button' | 'link')
Defaultundefined

The format for data in the column

Datetime format

Propcolumns[].dateTimeFormat
Typestring
Defaultundefined

A format string for datetimes in this column, (formatting reference)

Width Unit

Propcolumns[].widthUnit
Typestring
Defaultundefined

The unit of the width value

Min Width Unit

Propcolumns[].minWidthUnit
Typestring
Defaultundefined

The unit of the min-width value

Is Visible

Propcolumns[].isVisible
Typeboolean
Defaultundefined

Should the column be shown in the table

Allow Sort

Propcolumns[].allowSortBy
Typeboolean
Defaultundefined

Should the column be sortable

Link Text

Propcolumns[].linkText
Typestring
Defaultundefined

The text to display on the link

Target

Propcolumns[].linkTarget
TypeLinkTargetMethod ('_self' | '_blank' | '_parent' | '_top')
Defaultundefined

Specify the context in which the linked resource will open.

Button Text

Propcolumns[].buttonText
Typestring
Defaultundefined

The text to display on the button

On Click

Propcolumns[].onButtonClick
Type({ function: { ref: string } } | null)
Defaultundefined

What function will be called when the button is clicked

Flatten

Propflatten
Typeboolean
Defaultfalse

Whether or not to flatten the data source's keys. For example, if the data table receives a deeply nested row object like [{ "foo": { "bar": "baz", "qux": "quux" }], it will flatten these keys to two columns named foo.bar and foo.qux.

Allow Export

PropallowExport
Typeboolean
Defaultfalse

Whether or not to allow the user to download the underlying table data. This will not prevent sophisticated users or adversaries from accessing the data table directly, and therefore should not be used for purposes of securing the underlying data from prying eyes.

Export Format

PropexportFormat
TypeDataTableDownloadFormat ('CSV' | 'JSON')
DefaultJSON

The format of the document you receive when exporting table data.

Selected Row

PropselectedRow
Typeunknown
Defaultundefined

The currently selected row of the data table. This property contains the row object itself, and so can be used to access keys on the underlying object.

Selected Row Index

PropselectedRowIndex
Typenumber
Defaultundefined

The currently selected row's index within the data table. This property will reflect the numeric index within the data source that is selected. 0-indexed — the first row is 0, second row is 1, etc.

Default First

PropautoselectFirstRow
Typeboolean
Defaultfalse

Whether or not to auto-select the first row of the data table upon initialization. Useful for auto-advancing through items in the data table, such as when building approval workflows.

Pagination

ProppaginationEnabled
Typeboolean
Defaultfalse

Exposes the pagination controls for the user to bind to function calls

Page Size

ProppageSize
Typenumber
Defaultundefined

Number of rows per page, used to set parameters on paginated query

Current Offset

ProppaginationOffset
Typenumber
Default0

Offset to begin data query from, used to set parameters on paginated query

Current Page

PropcurrentPage
Typenumber
Default1

Current page being displayed

Total Rows

ProptotalRowCount
Typenumber
Defaultundefined

Number of entries in the data set, used to set bounds on pagination

Event Handlers

On Wheel

HandlerdataTableNode.onWheel

Called when the user scrolls the node. Use this event to trigger downstream actions when this node is scrolled.

On Hover

HandlerdataTableNode.onHover

Called when the user hovers on the node. Use this event to trigger downstream actions when this node is hovered.

On Leave

HandlerdataTableNode.onLeave

Called when the user is not hovering over the node. Use this event to trigger downstream actions when this node is no longer hovered.

On Select Row

HandlerdataTableNode.onSelectRow

Called when the selected row changes. Use this event to trigger downstream changes

On Refresh

HandlerdataTableNode.onRefresh

Called when the refresh button is clicked. Use this event to trigger downstream changes

Last updated on March 30, 2023