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.

Properties

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

autoColumnWidth

Whether to automatically set column widths.

Type boolean
Format True/False
Configurability Inspector > Appearance > Advanced > Automatic column width
Defaultfalse
Examples
true

caseSensitiveFiltering

Whether to perform case-sensitive filtering.

Type boolean
Configurability Inspector
Defaultnull

changesetArray

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

Type array
Array values object
Configurability Read-only
Defaultnull

changesetObject

A list of rows, by key or data index, with edited values. Keys correspond to either the primary key when the table is configured with a Primary key column or the data index of the changed row.

Type object
Format Custom data
Configurability Read-only
Defaultnull
Examples
{"row1": {"column1": "value1", "column2": "value2"}, "row2": {"column1": "value3", "column2": "value4"}}

columnOrdering

The order of the columns.

Type array
Array values string
Configurability Inspector
Defaultnull

data

The data.

Type string | number | boolean | object | array
Format Custom data
Configurability Inspector
Defaultnull

disableEdits

Whether to disable editing of values.

Type boolean
Configurability Read-only
Defaultnull

disableSave

Whether to disable saving changes for edited values.

Type boolean
Configurability Read-only
Defaultnull

emptyMessage

The message to display if no value is set.

Type string
Configurability Inspector > Appearance > Empty state
Defaultnull

events

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

Type array
Array values object
Configurability Inspector > Interaction > Event handlers
Defaultnull
Array Object Properties

event

The event that triggers the action. Refer to the events section for details of available events for this object.

Type string
Configurability Inspector > Interaction > Event handlers > Event
Defaultnull

method

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

Type string
Configurability Inspector > Interaction > Event handlers > Edit event handler > Run script actions
Defaultnull

type

The type of action to perform.

Type string
Configurability Inspector > Interaction > Event handlers > Edit event handler > Action
Allowed Values
ValueDescription
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).

Defaultnull


filterStack

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

Type object
Configurability Inspector > Interaction > Default filters
Defaultnull
Object Properties

filters

The filters to apply.

Type array
Array values object
Configurability Read-only
Defaultnull
Array Object Properties

columnId

The column on which to filter.

Type string
Configurability Inspector > Interaction > Default filters > Edit filter > Column
Defaultnull

operator

The operator.

Type string
Configurability Inspector > Interaction > Default filters > Edit filter > Operator
Allowed Values
ValueDescription
=

Equal to.

!=

Not equal to.

>

Greater than.

>=

Greater than or equal to.

<

Less than.

<=

Less than or equal to.

is

Is.

isNot

Is not.

includes

Includes.

doesNotInclude

Does not include.

isTrue

Is true.

isFalse

Is false.

isEmpty

Is empty.

isNotEmpty

Is not empty.

intersects

Intersects.

isOneOf

Is one of.

isNoneOf

Is none of.

isBefore

Is before.

isAfter

Is after.

Defaultnull



groupByColumns

A list of columns by which the Table is grouped.

Type array
Array values string
Configurability Inspector > Content > Advanced > Group rows by
Defaultnull

heightType

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

Type string
Format Plain Text
Configurability Inspector > Spacing > Height
Allowed Values
ValueDescription
fixed

Fixed height.

auto

Expand to fit content.

Defaultfixed

hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Configurability Inspector > Appearance > Hidden
Defaultfalse
Examples
true

id

The unique identifier (name).

Type string
Format Plain Text
Configurability Inspector
Defaulttable1
Examples
query1
button1

isHiddenOnDesktop

Whether to show or hide this object in the desktop layout.

Type boolean
Format True/False
Configurability Inspector > Appearance > Advanced > Show on desktop
Defaultfalse
Examples
true

isHiddenOnMobile

Whether to show or hide this object in the mobile layout.

Type boolean
Format True/False
Configurability Inspector > Appearance > Advanced > Show on mobile
Defaulttrue
Examples
true

maintainSpaceWhenHidden

Whether to take up space on the canvas if hidden is true.

Type boolean
Format True/False
Configurability Inspector > Appearance > Advanced > Maintain space when hidden
Defaultfalse
Examples
true

margin

The amount of margin to render outside.

Type string
Format Plain Text
Configurability Inspector > Spacing > Margin
Allowed Values
ValueUI OptionDescription
4px 8pxNormal

Normal margin.

0None

No margin.

Default4px 8px
Examples
4px 8px

newRows

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

Type array
Array values object
Configurability Read-only
Defaultnull

overflowActionsOverlayMaxHeight

The maximum height of the overflow actions overlay.

Type number
Configurability Read-only
Defaultnull

overflowActionsOverlayMinWidth

The minimum width of the overflow actions overlay.

Type number
Configurability Read-only
Defaultnull

overflowType

The overflow behavior when the contents exceeds the height.

Type string
Configurability Inspector
Allowed Values
ValueDescription
scroll

Display a scrollbar.

pagination

Use pagination.

Defaultnull

pagination

The pagination state.

Type object
Configurability Inspector > Content > Add-ons > Pagination
Defaultnull
Object Properties

afterCursor

The cursor to reference in a request for the next set of data.

Type string
Format Plain Text
Configurability Read-only
Defaultnull
Examples
"eyJ0eXBlIjoiZm9vIiwic3RhdHVzIjoiYmFyIn0="

beforeCursor

The cursor to reference in a request for the previous set of data.

Type string
Configurability Read-only
Defaultnull

currentPage

The currently selected page.

Type string
Format Plain Text
Configurability Read-only
Defaultnull
Examples
"page1"

offset

The page offset.

Type number
Configurability Read-only
Defaultnull

pageSize

The number of rows per page.

Type number
Configurability Read-only
Defaultnull

selectedPageIndex

The selected page, by index.

Type number
Configurability Read-only
Defaultnull

serverPaginated

Whether the data is paginated on the server.

Type boolean
Format True/False
Configurability Read-only
Defaultnull
Examples
true

serverPaginationType

The type of server-side pagination in use.

Type string
Configurability Inspector
Allowed Values
ValueDescription
limitOffsetBased

Limit offset based.

cursorBased

GraphQL Relay cursor based.

Defaultnull


searchMode

The type of search to perform.

Type string
Configurability Inspector
Allowed Values
ValueDescription
fuzzy

Searches using fuzzy logic.

caseInsensitive

Ignores the case used in search terms.

caseSensitive

Matches the case used in search terms.

Defaultnull

searchTerm

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

Type string
Configurability Inspector > Interaction > Search term
Defaultnull

selectedCell

The selected cell.

Type object
Configurability Read-only
Defaultnull

selectedDataIndex

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.

Type number
Configurability Read-only
Defaultnull

selectedDataIndexes

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

Type array
Array values number
Configurability Read-only
Defaultnull

selectedRow

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

Type object
Configurability Read-only
Defaultnull

selectedRowKey

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

Type number
Configurability Read-only
Defaultnull

selectedRowKeys

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

Type array
Array values number
Configurability Read-only
Defaultnull

selectedRows

A list of selected rows, by index.

Type array
Array values object
Configurability Read-only
Defaultnull

selectedSourceRow

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.

Type object
Configurability Read-only
Defaultnull

selectedSourceRows

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

Type array
Array values object
Configurability Read-only
Defaultnull

showInEditor

Whether the component remains visible in the editor if hidden is true.

Type boolean
Format True/False
Configurability Inspector > Appearance > Advanced > Always show in edit mode
Defaultfalse
Examples
true

sortArray

A list of column IDs and sort direction.

Type array
Array values object
Configurability Read-only
Defaultnull
Array Object Properties

columnId

The column ID.

Type string
Configurability Read-only
Defaultnull

sortDirection

The sort direction.

Type string
Configurability Read-only
Allowed Values
ValueDescription
ascending

Ascending.

descending

Descending.

Defaultnull


style

Custom style options.

Type object
Configurability Inspector > Appearance > style
Defaultnull

Methods

JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.

table.clearChangeset()

Clear changesetArray, changesetObject, and newRows values.

Definition
table.clearChangeset()
Examples

Clear the changeset for table.

table.clearChangeset();

table.clearFilter()

Clear the filter with the specified ID.

Definition
table.clearFilter(filter)
Parameters

filter

The ID of a filter applied to the table.

Type string

Examples

Clear filter userFilter from table.

table.clearFilter(userFilter);

table.clearFilterStack()

Clears all filters.

Definition
table.clearFilterStack()

table.clearSelection()

Clear the currently selected rows.

Definition
table.clearSelection()
Examples

Clear the selected rows from table.

table.clearSelection();

table.clearSort()

Clear the current sorting options.

Definition
table.clearSort()
Examples

Clear the sorting options from table.

table.clearSort();

table.collapseRows()

Collapse rows with the specified indexes.

Definition
table.collapseRows()
Examples

Collapse rows with indexes 1 and 2 in table.

table.collapseRows([1, 2]);

table.expandRows()

Expands rows with the specified indexes.

Definition
table.expandRows()

table.exportData()

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

Definition
table.exportData(options)
Parameters

options

The options for the export.

Type object
Object Properties

data

The data.

Type string | number | boolean | object | array
Format Custom data

fileName

The file name.

Type string

fileType

The file extension.

Type string



table.getDisplayedData()

Returns the currently displayed data in Table. Respects filtering and sorting. This method returns a promise and can only be used in JavaScript queries, not in transformers or {{ }} dynamic expressions.

Definition
await table.getDisplayedData()
Returns

Returns a Promise that resolves to the following:

data

The data.

Type string | number | boolean | object | array
Format Custom data


table.refresh()

Trigger all queries from which the component sources data.

Definition
table.refresh()
Examples

Refresh table.

table.refresh();

table.resetFilterStack()

Resets the Table to its default filters.

Definition
table.resetFilterStack()

table.scrollIntoView()

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

Definition
table.scrollIntoView(options)
Parameters

options

The scroll options.

Type object
Object Properties

behavior

The scroll behavior.

Type string
Allowed Values
ValueDescription
auto

Scroll immediately to the specified position.

smooth

Scroll gradually to the specified position.


block

The scroll position relative to the component.

Type string
Allowed Values
ValueDescription
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.



Examples

Scroll the minimum amount to immediately bring table into view.

table.scrollIntoView({behavior: 'auto', block: 'nearest'});

table.scrollToRow()

Scrolls to a specific row.

Definition
table.scrollToRow()
Examples

Scroll to row userRow in table.

table.scrollToRow(userRow);

table.selectNextRow()

Select the next row.

Definition
table.selectNextRow()
Examples

Select the next row in table.

table.selectNextRow();

table.selectPreviousRow()

Select the previous row.

Definition
table.selectPreviousRow()

table.selectRow()

Selects a specific row.

Definition
table.selectRow(mode, indexType, index, key)
Parameters

mode

The method for targeting rows.

Type string
Allowed Values
ValueDescription
index

Targets a specific index.

key

Targets the row of the first matching item in the Table's configured primary key column.

all

Targets all rows.


indexType

When the row is targeted by index, the type of index to use.

Type string
Allowed Values
ValueDescription
display

Targets the row at the given index in the table's displayed order.

data

Targets the row corresponding to the data at the given index, regardless of the table's displayed order.


index

When the row is targeted by index, the value used to find a matching row.

Type string

key

When the row is targeted by key, the value used to find a matching row.

Type string


table.setFilter()

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

Definition
table.setFilter()

table.setFilterStack()

Sets filters and operator to apply to the Table

Definition
table.setFilterStack(filterStack)
Parameters

filterStack

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

Type object
Object Properties

filters

The filters to apply.

Type array
Array values object
Array Object Properties

columnId

The column on which to filter.

Type string

operator

The operator.

Type string
Allowed Values
ValueDescription
=

Equal to.

!=

Not equal to.

>

Greater than.

>=

Greater than or equal to.

<

Less than.

<=

Less than or equal to.

is

Is.

isNot

Is not.

includes

Includes.

doesNotInclude

Does not include.

isTrue

Is true.

isFalse

Is false.

isEmpty

Is empty.

isNotEmpty

Is not empty.

intersects

Intersects.

isOneOf

Is one of.

isNoneOf

Is none of.

isBefore

Is before.

isAfter

Is after.





table.setGrouping()

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

Definition
table.setGrouping(options)
Parameters

options

(No description available)

Type unknown
Object Properties

columnId

The column ID to sort by.

Type string

fileType

The file extension.

Type string

sortDirection

The sort direction for the items.

Type string
Allowed Values
ValueDescription
ascending

Ascending sort order.

descending

Descending sort order.




table.setHidden()

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

Definition
table.setHidden(hidden)
Parameters

hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Default
false
Examples
true

Examples

Hide table.

table.setHidden(true);

Unhide table.

table.setHidden(false);

table.setPage()

Set the current page.

Definition
table.setPage(page)
Parameters

page

The current page.

Type number


table.setSort()

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

Definition
table.setSort()

table.updateLinkedFilter()

Update the value of the linked Filter component.

Definition
table.updateLinkedFilter(filterStack)
Parameters

filterStack

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

Type object
Object Properties

filters

The filters to apply.

Type array
Array values object
Array Object Properties

columnId

The column on which to filter.

Type string

operator

The operator.

Type string
Allowed Values
ValueDescription
=

Equal to.

!=

Not equal to.

>

Greater than.

>=

Greater than or equal to.

<

Less than.

<=

Less than or equal to.

is

Is.

isNot

Is not.

includes

Includes.

doesNotInclude

Does not include.

isTrue

Is true.

isFalse

Is false.

isEmpty

Is empty.

isNotEmpty

Is not empty.

intersects

Intersects.

isOneOf

Is one of.

isNoneOf

Is none of.

isBefore

Is before.

isAfter

Is after.





Events

Events triggered by user interactions. You can configure event handlers in the IDE to trigger queries or other actions in response to events.

EventDescription
BlurThe input field is deselected.
CancelAn action is canceled.
ChangeThe value is changed.
Change CellA cell value is changed.
Change FilterA filter is changed.
Change PageThe current page is changed.
Change Row SelectionThe selected row is changed.
Change SortA sorting option is changed.
Click ActionAn action button is clicked or pressed.
Click CellA cell is clicked or pressed.
Click RowA row is clicked or pressed.
Click ToolbarA toolbar button is clicked or pressed.
Deselect RowA row is deselected.
Double Click RowA row is double-clicked or pressed.
Expand RowA row is expanded.
FocusThe input field is selected.
SaveChanges are saved.
Select CellA cell is selected.
Select RowA row is selected.