Disabled Rows

View as Markdown
Disabling rows allows you to have some rows that are not selectable, not clickable, not reacheable via keyboard navigation and other interactions.
The DataSource manages the disabled state of rows, via the defaultRowDisabledState (uncontrolled) prop and rowDisabledState (controlled) prop.
<DataSource<DATA_TYPE>
  primaryKey="id"
  data={[]}
  defaultRowDisabledState={{
    enabledRows: true,
    disabledRows: ['id1', 'id4', 'id5']
  }}
>
  <InfiniteTable<DATA_TYPE>
    columns={columns}
  />
</DataSource>
In addition to using the defaultRowDisabledState/rowDisabledState props, you can also specify the isRowDisabled function prop, which overrides those other props and ultimately determines whether a row is disabled or not.
#
Specify some rows as initially disabled
open
loading demo…

Using disabled rows while rendering#

When rendering a cell, you have access to the row disabled state - the InfiniteTableRowInfo type has a rowDisabled property which is true if the row is disabled.
#
Using the row disabled state while rendering
This example uses custom rendering for the firstName column to render an emoji for disabled rows.
open
loading demo…

Using the API to enable/disable rows#

You can use the DataSourceApi to enable or disable rows programmatically.
setRowEnabled
dataSourceApi.setRowEnabled(rowId, enabled);
setRowEnabledAt
dataSourceApi.setRowEnabledAt(rowIndex, enabled);
#
Using the API to enable/disable rows
Use the context menu on each row to toggle the disabled state of the respective row.
open
loading demo…