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 |
Default | false |
Examples
true
caseSensitiveFiltering
Whether to perform case-sensitive filtering.
Type | boolean |
Configurability | Inspector |
Default | null |
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 |
Default | null |
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 |
Default | null |
Examples
{"row1": {"column1": "value1", "column2": "value2"}, "row2": {"column1": "value3", "column2": "value4"}}
columnOrdering
The order of the columns.
Type | array |
Array values | string |
Configurability | Inspector |
Default | null |
data
The data.
Type | string | number | boolean | object | array |
Format | Custom data |
Configurability | Inspector |
Default | null |
disableSave
Whether to disable saving changes for edited values.
Type | boolean |
Configurability | Read-only |
Default | null |
emptyMessage
The message to display if no value is set.
Type | string |
Configurability | Inspector > Appearance > Empty state |
Default | null |
events
A list of configured event handlers that trigger actions or queries.
Type | array |
Array values | object |
Configurability | Inspector > Interaction > Event handlers |
Default | null |
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 |
Default | null |
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 |
Default | null |
type
The type of action to perform.
Type | string | ||||||||||||||
Configurability | Inspector > Interaction > Event handlers > Edit event handler > Action | ||||||||||||||
Allowed Values |
| ||||||||||||||
Default | null |
filterStack
A list of filters that apply and the operator to which they evaluate.
Type | object |
Configurability | Inspector > Interaction > Default filters |
Default | null |
Object Properties
Array Object Properties
columnId
The column on which to filter.
Type | string |
Configurability | Inspector > Interaction > Default filters > Edit filter > Column |
Default | null |
operator
The operator.
Type | string | ||||||||||||||||||||||||||||||||||||||||
Configurability | Inspector > Interaction > Default filters > Edit filter > Operator | ||||||||||||||||||||||||||||||||||||||||
Allowed Values |
| ||||||||||||||||||||||||||||||||||||||||
Default | null |
groupByColumns
A list of columns by which the Table is grouped.
Type | array |
Array values | string |
Configurability | Inspector > Content > Advanced > Group rows by |
Default | null |
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 |
| ||||||
Default | fixed |
hidden
Whether this object is hidden from view.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Hidden |
Default | false |
Examples
true
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 |
Default | false |
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 |
Default | true |
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 |
Default | false |
Examples
true
margin
The amount of margin to render outside.
Type | string | |||||||||
Format | Plain Text | |||||||||
Configurability | Inspector > Spacing > Margin | |||||||||
Allowed Values |
| |||||||||
Default | 4px 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 |
Default | null |
overflowActionsOverlayMaxHeight
The maximum height of the overflow actions overlay.
Type | number |
Configurability | Read-only |
Default | null |
overflowActionsOverlayMinWidth
The minimum width of the overflow actions overlay.
Type | number |
Configurability | Read-only |
Default | null |
overflowType
The overflow behavior when the contents exceeds the height.
Type | string | ||||||
Configurability | Inspector | ||||||
Allowed Values |
| ||||||
Default | null |
pagination
The pagination state.
Type | object |
Configurability | Inspector > Content > Add-ons > Pagination |
Default | null |
Object Properties
afterCursor
The cursor to reference in a request for the next set of data.
Type | string |
Format | Plain Text |
Configurability | Read-only |
Default | null |
Examples
"eyJ0eXBlIjoiZm9vIiwic3RhdHVzIjoiYmFyIn0="
beforeCursor
The cursor to reference in a request for the previous set of data.
Type | string |
Configurability | Read-only |
Default | null |
currentPage
The currently selected page.
Type | string |
Format | Plain Text |
Configurability | Read-only |
Default | null |
Examples
"page1"
serverPaginated
Whether the data is paginated on the server.
Type | boolean |
Format | True/False |
Configurability | Read-only |
Default | null |
Examples
true
serverPaginationType
The type of server-side pagination in use.
Type | string | ||||||
Configurability | Inspector | ||||||
Allowed Values |
| ||||||
Default | null |
searchMode
The type of search to perform.
Type | string | ||||||||
Configurability | Inspector | ||||||||
Allowed Values |
| ||||||||
Default | null |
searchTerm
An optional string to filter the displayed options. Matches values or labels if provided.
Type | string |
Configurability | Inspector > Interaction > Search term |
Default | null |
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 |
Default | null |
selectedDataIndexes
The source data row indexes that corresponds to the selected rows.
Type | array |
Array values | number |
Configurability | Read-only |
Default | null |
selectedRow
The selected row. If rowSelection
is multiple
, the most recently selected row.
Type | object |
Configurability | Read-only |
Default | null |
selectedRowKey
The selected row, by key, when the table is configured with a Primary key column.
Type | number |
Configurability | Read-only |
Default | null |
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 |
Default | null |
selectedRows
A list of selected rows, by index.
Type | array |
Array values | object |
Configurability | Read-only |
Default | null |
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 |
Default | null |
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 |
Default | null |
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 |
Default | false |
Examples
true
sortArray
A list of column IDs and sort direction.
Type | array |
Array values | object |
Configurability | Read-only |
Default | null |
Array Object Properties
sortDirection
The sort direction.
Type | string | ||||||
Configurability | Read-only | ||||||
Allowed Values |
| ||||||
Default | null |
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()
Examples
Clear the changeset for table
.
table.clearChangeset();
table.clearFilter(filter)
Examples
Clear filter userFilter
from table
.
table.clearFilter(userFilter);
table.clearSelection()
Examples
Clear the selected rows from table
.
table.clearSelection();
table.clearSort()
Examples
Clear the sorting options from table
.
table.clearSort();
table.collapseRows()
Examples
Collapse rows with indexes 1
and 2
in table
.
table.collapseRows([1, 2]);
table.exportData(options)
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.
await table.getDisplayedData()
Returns
table.refresh()
Examples
Refresh table
.
table.refresh();
table.scrollIntoView()
Scrolls the canvas or parent container so that the selected component appears in the visible area.
table.scrollIntoView(options)
Parameters
Object Properties
behavior
The scroll behavior.
Type | string | ||||||
Allowed Values |
|
block
The scroll position relative to the component.
Type | string | ||||||||||
Allowed Values |
|
Examples
Scroll the minimum amount to immediately bring table
into view.
table.scrollIntoView({behavior: 'auto', block: 'nearest'});
table.scrollToRow()
Examples
Scroll to row userRow
in table
.
table.scrollToRow(userRow);
table.selectNextRow()
Examples
Select the next row in table
.
table.selectNextRow();
table.selectRow(mode, indexType, index, key)
Parameters
mode
The method for targeting rows.
Type | string | ||||||||
Allowed Values |
|
indexType
When the row is targeted by index, the type of index to use.
Type | string | ||||||
Allowed Values |
|
table.setFilter()
Add a filter to the current filter stack. Updates an existing filter if a corresponding ID is provided.
table.setFilter()
table.setFilterStack(filterStack)
Parameters
Object Properties
Array Object Properties
operator
The operator.
Type | string | ||||||||||||||||||||||||||||||||||||||||
Allowed Values |
|
table.setGrouping()
Set the columns with which the table should group. Sort direction defaults to ascending.
table.setGrouping(options)
Parameters
table.setHidden()
Set the hidden
value to toggle whether the component is visible. Defaults to true
without a parameter.
table.setHidden(hidden)
Parameters
Examples
true
Examples
Hide table
.
table.setHidden(true);
Unhide table
.
table.setHidden(false);
table.setPage(page)
table.setSort()
Sort rows by the specified column and direction. Optionally provide an array of objects to sort by multiple columns.
table.setSort()
table.updateLinkedFilter(filterStack)
Parameters
Object Properties
Array Object Properties
operator
The operator.
Type | string | ||||||||||||||||||||||||||||||||||||||||
Allowed Values |
|
Events
Events triggered by user interactions. You can configure event handlers in the IDE to trigger queries or other actions in response to events.
Event | Description |
---|---|
Blur | The input field is deselected. |
Cancel | An action is canceled. |
Change | The value is changed. |
Change Cell | A cell value is changed. |
Change Filter | A filter is changed. |
Change Page | The current page is changed. |
Change Row Selection | The selected row is changed. |
Change Sort | A sorting option is changed. |
Click Action | An action button is clicked or pressed. |
Click Cell | A cell is clicked or pressed. |
Click Row | A row is clicked or pressed. |
Click Toolbar | A toolbar button is clicked or pressed. |
Deselect Row | A row is deselected. |
Double Click Row | A row is double-clicked or pressed. |
Expand Row | A row is expanded. |
Focus | The input field is selected. |
Save | Changes are saved. |
Select Cell | A cell is selected. |
Select Row | A row is selected. |