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.
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.
autoColumnWidth
Whether to automatically set column widths.
caseSensitiveFiltering
Whether to perform case-sensitive filtering.
changesetArray
A list of rows, by index, with edited values and primary key when the table is configured with a Primary key column.
disableEdits
Whether to disable editing of values.
disableSave
Whether to disable saving changes for edited values.
emptyMessage
The message to display if no value is set.
Properties
event
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 |
false | A user sets the value to |
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
The JavaScript method to perform when type
is datasource
, widget
, state
, or localStorage
.
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
A list of filters that apply and the operator to which they evaluate.
global
Whether the object is globally scoped for use in all app pages.
groupByColumns
A list of columns by which the Table is grouped.
heightType
Whether the height automatically resizes to fit content or is a fixed size.
Values
fixed | Fixed height. |
auto | Expand to fit content. |
id
The unique identifier.
isHiddenOnDesktop
Whether the component is visible in the desktop layout.
isHiddenOnMobile
Whether the component is visible in the mobile layout.
maintainSpaceWhenHidden
Whether the component takes up space on the canvas if hidden
is true
.
newRows
A list of newly added rows. Each new row is an object with an entry for each edited value.
overflowActionsOverlayMaxHeight
The maximum height of the overflow actions overlay.
overflowActionsOverlayMinWidth
The minimum width of the overflow actions overlay.
overflowType
The overflow behavior when the contents exceeds the height.
Values
scroll | Display a scrollbar. |
pagination | Use pagination. |
pagination
The pagination state.
Properties
afterCursor
The cursor to reference in a request for the next set of data.
beforeCursor
The cursor to reference in a request for the previous set of data.
currentPage
The selected page.
offset
The page offset.
pageSize
The number of rows per page.
selectedPageIndex
The selected page, by index.
serverPaginated
Whether to use server-side pagination.
The type of server-side pagination in use.
Values
limitOffsetBased | Limit offset based. |
cursorBased | GraphQL Relay cursor based. |
pluginType
The plugin type.
searchMode
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. |
searchTerm
An optional string to filter the displayed options. Matches values or labels if provided.
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.
selectedDataIndexes
The source data row indexes that corresponds to the selected rows.
selectedRow
The selected row. If rowSelection
is multiple
, the most recently selected row.
selectedRowKey
The selected row, by key, when the table is configured with a Primary key column.
selectedRowKeys
A list of selected rows, by key, when the table is configured with a Primary key column.
selectedRows
A list of selected rows, by index.
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.
selectedSourceRows
A list of selected source rows, by index. Excludes mapped values or custom columns that are not present in the source data.
showInEditor
Whether to remain visible in the editor if hidden
is true
.
sortArray
A list of column IDs and sort direction.
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.
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.
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
The scroll options.
Properties
behavior
The scroll behavior.
Values
auto | Scroll immediately to the specified position. |
smooth | Scroll gradually to the specified position. |
block
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
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.
setHidden
Set the hidden
value to toggle whether the component is visible. Defaults to true
without a parameter.
table.setHidden(hidden)
Parameters
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
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.