Skip to main content

The Table component for Retool Apps

A table to display data that can be sorted, filtered, paginated, and edited.

Table renders an array of data, such as database records, as a tabulated list. Refer to the working with tables guide to learn more about using the Table component.

Settings

Table includes the following configurable options when building apps in the IDE.

Automatic column widthEnable case sensitive filteringDataEmpty stateEvent handlersHeightShow on desktopShow on mobileMaintain space when hiddenMarginOverflowSearchSearch termAlways show in edit modeStyles

Properties

All properties for Table with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read property values.

Whether to automatically set column widths.


Whether to perform case-sensitive filtering.


changesetArray

object[]

A list of rows, by index, with edited values and primary key when the table is configured with a Primary key column.


data

any[]

The source data.


disableEdits

boolean

Whether to disable editing of values.


disableSave

boolean

Whether to disable saving changes for edited values.


The message to display if no value is set.


events

object[]

A list of configured event handlers that trigger actions or queries.

Properties

event

enum

The event type.

Values
change

A user changes the value.

click

A user clicks or taps the component.

submit

A user submits the value.

focus

A user selects the input field.

blur

A user deselects the input field.

scan

A user scans a barcode.

open

A user opens the component.

close

A user closes the component.

true

A user sets the value to true.

false

A user sets the value to false.

select

A user selects a value.

clear

A user clears the value.

upload

A user uploads a file.

parse

An uploaded file is parsed.

inputValueChange

A user changes the value of the input field.


method

enum

The JavaScript method to perform when type is datasource, widget, state, or localStorage.


The type of action to perform.

Values
datasource

Control query.

widget

Control component.

script

Run script.

state

Set variable.

localStorage

Set localStorage.

util

Perform utility action (e.g., Open URL or Confetti).



filterStack

object

A list of filters that apply and the operator to which they evaluate.


global

boolean

Whether the object is globally scoped for use in all app pages.


groupByColumns

string[]

A list of columns by which the Table is grouped.


Whether the height automatically resizes to fit content or is a fixed size.

Values
fixed

Fixed height.

auto

Expand to fit content.


boolean

Whether the component is visible.


id

string

The unique identifier.


Whether the component is visible in the desktop layout.


Whether the component is visible in the mobile layout.


Whether the component takes up space on the canvas if hidden is true.


The amount of margin to render outside.

Values
4px 8px

Normal margin.

0

No margin.


newRows

object[]

A list of newly added rows. Each new row is an object with an entry for each edited value.


overflowActionsOverlayMaxHeight

number

The maximum height of the overflow actions overlay.


overflowActionsOverlayMinWidth

number

The minimum width of the overflow actions overlay.


The overflow behavior when the contents exceeds the height.

Values
scroll

Display a scrollbar.

pagination

Use pagination.



pluginType

string

The plugin type.


The type of search to perform.

Values
fuzzy

Searches using fuzzy logic.

caseInsensitive

Ignores the case used in search terms.

caseSensitive

Matches the case used in search terms.


An optional string to filter the displayed options. Matches values or labels if provided.


selectedDataIndex

number

The source data row index that corresponds to the selected row. If multiple row selection is enabled, the data of the most recently selected row.


selectedDataIndexes

number[]

The source data row indexes that corresponds to the selected rows.


selectedRow

object

The selected row. If rowSelection is multiple, the most recently selected row.


selectedRowKey

number

The selected row, by key, when the table is configured with a Primary key column.


selectedRowKeys

number[]

A list of selected rows, by key, when the table is configured with a Primary key column.


selectedRows

object[]

A list of selected rows, by index.


selectedSourceRow

object

The selected source row. If rowSelection is multiple, the most recently selected source row. Excludes mapped values or custom columns that are not present in the source data.


selectedSourceRows

object[]

A list of selected source rows, by index. Excludes mapped values or custom columns that are not present in the source data.


Whether to remain visible in the editor if hidden is true.


sortArray

object[]

A list of column IDs and sort direction.


style

object

Custom style options in use. Not all style options may be available for all components.


Methods

JavaScript API methods for interacting with Table. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.

clearChangeset

Clear changesetArray, changesetObject, and newRows values.

table.clearChangeset()

clearFilter

Clear the filter with the specified ID.

table.clearFilter(value)
Parameters

The value.



clearFilterStack

Clears all filters. To reset to the default filters, use resetFilterStack() instead.

table.clearFilterStack()

clearSelection

Clear the currently selected rows.

table.clearSelection()

clearSort

Clear the current sorting options.

table.clearSort()

collapseRows

Collapse rows with the specified indexes.

table.collapseRows()

expandRows

Expands rows with the specified indexes.

table.expandRows()

exportData

Exports table data as a file in a CSV, TSV, JSON, or Excel format.

table.exportData(exportDataOptions)
Parameters

exportDataOptions

object
Properties

data

any[]

The source data.


fileName

string

The file name.


fileType

string

The file extension.




getDisplayedData

Returns the currently displayed data in Table. Respects filtering and sorting.

table.getDisplayedData()

refresh

Trigger all queries from which the component sources data.

table.refresh()

resetFilterStack

Resets the Table to its default filters. To clear all filters, use clearFilterStack() instead.

table.resetFilterStack()

scrollIntoView

Scrolls the canvas or parent container so that the selected component appears in the visible area.

table.scrollIntoView(scrollIntoViewOptions)
Parameters

scrollIntoViewOptions

object

The scroll options.

Properties

behavior

enum

The scroll behavior.

Values
auto

Scroll immediately to the specified position.

smooth

Scroll gradually to the specified position.


block

enum

The scroll position relative to the component.

Values
nearest

Scrolls only the minimum amount required for the component to appear in the visible area. Scrolling does not occur if the component is already in view.

start

Scrolls to position the component at the top of the visible area.

center

Scrolls to position the component in the middle of the visible area.

end

Scrolls to position the component at the bottom of the visible area.




scrollToRow

Scrolls to a specific row.

table.scrollToRow()

selectNextRow

Select the next row.

table.selectNextRow()

selectPreviousRow

Select the previous row.

table.selectPreviousRow()

selectRow

Selects a specific row.

table.selectRow()

setFilter

Add a filter to the current filter stack. Updates an existing filter if a corresponding ID is provided.

table.setFilter()

setFilterStack

Sets filters and operator to apply to the Table

table.setFilterStack(filterStack)
Parameters

filterStack

object

A list of filters that apply and the operator to which they evaluate.



setGrouping

Set the columns with which the table should group. Sort direction defaults to ascending.

table.setGrouping(setGroupingOptions)
Parameters

setGroupingOptions

object
Properties

columnId

string

The column ID to sort by.


fileType

string

The file extension.


sortDirection

enum

The sort direction for the items.

Values
ascending

Ascending sort order.

descending

Descending sort order.




setHidden

Set the hidden value to toggle whether the component is visible. Defaults to true without a parameter.

table.setHidden(hidden)
Parameters

boolean

Whether the component is visible.



setPage

Set the current page.

table.setPage(page)
Parameters

page



setSort

Sort rows by the specified column and direction. Optionally provide an array of objects to sort by multiple columns

table.setSort()

updateLinkedFilter

Update the value of the linked Filter component.

table.updateLinkedFilter(filterStack)
Parameters

filterStack

object

A list of filters that apply and the operator to which they evaluate.



Events

Events are triggered by user interactions, such as clicking a button or entering a value. Use event handlers to trigger queries or other actions in response to events.

blur

The input field is blurred.


cancel

An action is canceled.


change

The value is changed.


changeCell

The value of a cell is changed.


changeFilter

A filter is changed.


changePage

The page is changed.


changeRowSelection

A selected row is changed.


changeSort

The sorting option is changed.


clickAction

An action button is clicked or pressed.


clickCell

A cell is clicked or pressed.


clickRow

A row is clicked or pressed.


clickToolbar

A toolbar item is clicked or pressed.


deselectRow

A selected row is deselected.


doubleClickRow

A row is double-clicked.


expandRow

A row is expanded.


focus

The input field is focused.


save

Changes are saved.


selectCell

A cell is selected.


selectRow

A row is selected.