Dash DataTable
Dash DataTable (`dash.dash_table.DataTable`) is an interactive table component designed for viewing, editing, and exploring large datasets within Dash web applications. It is rendered with standard HTML <table> markup, making it accessible, responsive, and highly customizable. The `dash-table` PyPI package is currently at version 5.0.0, but the component is officially deprecated and slated for removal from the core Dash API in Dash 5.0 of the main `dash` package. Users are advised to migrate to `dash-ag-grid` for future development.
Warnings
- breaking Dash DataTable is officially deprecated and will be removed from the core Dash API in Dash 5.0. It is strongly recommended to migrate to `dash-ag-grid` for new and existing projects.
- breaking Significant API changes occurred in `dash-table` v4.0.0. Several properties were removed or renamed, such as `column.clearable`, `column.hidden`, `content_style` (replaced by `fill_width`), and `pagination_settings` (replaced by `page_current` and `page_size`).
- gotcha When using pagination with tooltips, the DataTable may become unresponsive and generate errors upon hovering over cells.
- gotcha For callbacks interacting with the DataTable, ensuring correct return types for multiple outputs is crucial. For instance, a callback with two outputs must return a tuple (data, columns) not a single Div component.
Install
-
pip install dash-table -
pip install dash-ag-grid
Imports
- DataTable
from dash import dash_table
Quickstart
import dash
from dash import dash_table, html
import pandas as pd
# Sample data (e.g., from a CSV)
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')
app = dash.Dash(__name__)
app.layout = html.Div([
dash_table.DataTable(
id='table-basic',
columns=[{"name": i, "id": i} for i in df.columns],
data=df.to_dict('records'),
)
])
if __name__ == '__main__':
app.run_server(debug=True)