dash_table.DataTable

Deprecation Notice: Dash DataTable is deprecated and will be removed from the core Dash API in Dash 5.0.
We recommend migrating to Dash AG Grid. Install with pip install dash-ag-grid.
See the Getting Started page for an introduction to Dash AG Grid.

DataTable Properties

Access this documentation in your Python terminal with:
```python

help(dash.dash_table.DataTable)
```

Our recommended IDE for writing Dash apps is Dash Enterprise’s
Data Science Workspaces,
which has typeahead support for Dash Component Properties.
Find out if your company is using
Dash Enterprise
.

data (list of dicts with strings as keys and values of type string | number | boolean; optional):
The contents of the table. The keys of each item in data should match
the column IDs. Each item can also have an ‘id’ key, whose value is
its row ID. If there is a column with ID=’id’ this will display the
row ID, otherwise it is just used to reference the row for selections,
filtering, etc. Example: [ {‘column-1’: 4.5, ‘column-2’:
‘montreal’, ‘column-3’: ‘canada’}, {‘column-1’: 8, ‘column-2’:
‘boston’, ‘column-3’: ‘america’} ].

columns (list of dicts; optional):
Columns describes various aspects about each individual column. name
and id are the only required parameters.

columns is a list of dicts with keys:

  • clearable (a value equal to: ‘first’ or ‘last’ | boolean | list of booleans; optional):
    If True, the user can clear the column by clicking on the clear
    action button on the column. If there are multiple header rows,
    True will display the action button on each row. If last, the
    clear action button will only appear on the last header row. If
    first it will only appear on the first header row. These are
    respectively shortcut equivalents to [False, ..., False, True]
    and [True, False, ..., False]. If there are merged, multi-header
    columns then you can choose which column header row to display the
    clear action button in by supplying an array of booleans. For
    example, [True, False] will display the clear action button on
    the first row, but not the second row. If the clear action
    button appears on a merged column, then clicking on that button
    will clear all of the merged columns associated with it. Unlike
    column.deletable, this action does not remove the column(s) from
    the table. It only removed the associated entries from data.

  • deletable (a value equal to: ‘first’ or ‘last’ | boolean | list of booleans; optional):
    If True, the user can remove the column by clicking on the
    delete action button on the column. If there are multiple header
    rows, True will display the action button on each row. If last,
    the delete action button will only appear on the last header
    row. If first it will only appear on the first header row. These
    are respectively shortcut equivalents to [False, ..., False, True] and [True, False, ..., False]. If there are merged,
    multi-header columns then you can choose which column header row
    to display the delete action button in by supplying an array of
    booleans. For example, [True, False] will display the delete
    action button on the first row, but not the second row. If the
    delete action button appears on a merged column, then clicking
    on that button will remove all of the merged columns associated
    with it.

  • editable (boolean; optional):
    There are two editable flags in the table. This is the
    column-level editable flag and there is also the table-level
    editable flag. These flags determine whether the contents of the
    table are editable or not. If the column-level editable flag is
    set it overrides the table-level editable flag for that column.

  • filter_options (dict; optional):
    There are two filter_options props in the table. This is the
    column-level filter_options prop and there is also the table-level
    filter_options prop. If the column-level filter_options prop
    is set it overrides the table-level filter_options prop for that
    column.

    filter_options is a dict with keys:

    • case (a value equal to: ‘sensitive’ or ‘insensitive’; optional):
      (default: ‘sensitive’) Determine whether the applicable filter
      relational operators will default to sensitive or
      insensitive comparison.

    • placeholder_text (string; optional):
      (default: ‘filter data…’) The filter cell placeholder text.

  • format (dict; optional):
    The formatting applied to the column’s data. This prop is derived
    from the d3-format library
    specification. Apart from being structured slightly differently
    (under a single prop), the usage is the same. See also
    dash_table.FormatTemplate. It contains helper functions for
    typical number formats.

    format is a dict with keys:

    • locale (dict; optional):
      Represents localization specific formatting information. When
      left unspecified, will use the default value provided by
      d3-format.

      locale is a dict with keys:

      • decimal (string; optional):
        (default: ‘.’). The string used for the decimal separator.

      • group (string; optional):
        (default: ‘,’). The string used for the groups separator.

      • grouping (list of numbers; optional):
        (default: [3]). A list of integers representing the
        grouping pattern. The default is 3 for thousands.

      • numerals (list of strings; optional):
        A list of ten strings used as replacements for numbers 0-9.

      • percent (string; optional):
        (default: ‘%’). The string used for the percentage symbol.

      • separate_4digits (boolean; optional):
        (default: True). Separates integers with 4-digits or less.

      • symbol (list of strings; optional):
        (default: [‘$’, ‘’]). A list of two strings representing
        the prefix and suffix symbols. Typically used for
        currency, and implemented using d3’s currency format, but
        you can use this for other symbols such as measurement
        units.

    • nully (boolean | number | string | list | dict; optional):
      A value that will be used in place of the Noney value during
      formatting. If the value type matches the column type, it
      will be formatted normally.

    • prefix (number; optional):
      A number representing the SI unit to use during formatting.
      See dash_table.Format.Prefix enumeration for the list of
      valid values.

    • specifier (string; optional):
      (default: ‘’). Represents the d3 rules to apply when
      formatting the number.

  • hideable (a value equal to: ‘first’ or ‘last’ | boolean | list of booleans; optional):
    If True, the user can hide the column by clicking on the hide
    action button on the column. If there are multiple header rows,
    True will display the action button on each row. If last, the
    hide action button will only appear on the last header row. If
    first it will only appear on the first header row. These are
    respectively shortcut equivalents to [False, ..., False, True]
    and [True, False, ..., False]. If there are merged, multi-header
    columns then you can choose which column header row to display the
    hide action button in by supplying an array of booleans. For
    example, [True, False] will display the hide action button on
    the first row, but not the second row. If the hide action button
    appears on a merged column, then clicking on that button will hide
    all of the merged columns associated with it.

  • id (string; required):
    The id of the column. The column id is used to match cells in
    data with particular columns. The id is not visible in the table.

  • name (string | list of strings; required):
    The name of the column, as it appears in the column header. If
    name is a list of strings, then the columns will render with
    multiple headers rows.

  • on_change (dict; optional):
    The on_change behavior of the column for user-initiated
    modifications.

    on_change is a dict with keys:

    • action (a value equal to: ‘coerce’, ‘none’ or ‘validate’; optional):
      (default ‘coerce’): ‘none’: do not validate data; ‘coerce’:
      check if the data corresponds to the destination type and
      attempts to coerce it into the destination type if not;
      ‘validate’: check if the data corresponds to the destination
      type (no coercion).

    • failure (a value equal to: ‘accept’, ‘default’ or ‘reject’; optional):
      (default ‘reject’): What to do with the value if the action
      fails. ‘accept’: use the invalid value; ‘default’: replace
      the provided value with validation.default; ‘reject’: do
      not modify the existing value.

  • presentation (a value equal to: ‘input’, ‘dropdown’ or ‘markdown’; optional):
    The presentation to use to display data. Markdown can be used on
    columns with type ‘text’. See ‘dropdown’ for more info. Defaults
    to ‘input’ for [‘datetime’, ‘numeric’, ‘text’, ‘any’].

  • renamable (a value equal to: ‘first’ or ‘last’ | boolean | list of booleans; optional):
    If True, the user can rename the column by clicking on the
    rename action button on the column. If there are multiple header
    rows, True will display the action button on each row. If last,
    the rename action button will only appear on the last header
    row. If first it will only appear on the first header row. These
    are respectively shortcut equivalents to [False, ..., False, True] and [True, False, ..., False]. If there are merged,
    multi-header columns then you can choose which column header row
    to display the rename action button in by supplying an array of
    booleans. For example, [True, False] will display the rename
    action button on the first row, but not the second row. If the
    rename action button appears on a merged column, then clicking
    on that button will rename all of the merged columns associated
    with it.

  • selectable (a value equal to: ‘first’ or ‘last’ | boolean | list of booleans; optional):
    If True, the user can select the column by clicking on the
    checkbox or radio button in the column. If there are multiple
    header rows, True will display the input on each row. If last,
    the input will only appear on the last header row. If first it
    will only appear on the first header row. These are respectively
    shortcut equivalents to [False, ..., False, True] and [True, False, ..., False]. If there are merged, multi-header columns
    then you can choose which column header row to display the input
    in by supplying an array of booleans. For example, [True, False]
    will display the selectable input on the first row, but now on
    the second row. If the selectable input appears on a merged
    columns, then clicking on that input will select all of the
    merged columns associated with it. The table-level prop
    column_selectable is used to determine the type of column
    selection to use.

  • sort_as_null (list of strings | numbers | booleans; optional):
    An array of string, number and boolean values that are treated as
    None (i.e. ignored and always displayed last) when sorting. This
    value overrides the table-level sort_as_None.

  • type (a value equal to: ‘any’, ‘numeric’, ‘text’ or ‘datetime’; optional):
    The data-type provides support for per column typing and allows
    for data validation and coercion. ‘numeric’: represents both
    floats and ints. ‘text’: represents a string. ‘datetime’: a string
    representing a date or date-time, in the form: ‘YYYY-MM-DD
    HH:MM:SS.ssssss’ or some truncation thereof. Years must have 4
    digits, unless you use validation.allow_YY: True. Also accepts
    ‘T’ or ‘t’ between date and time, and allows timezone info at
    the end. To convert these strings to Python datetime objects,
    use dateutil.parser.isoparse. In R use parse_iso_8601 from the
    parsedate library. WARNING: these parsers do not work with
    2-digit years, if you use validation.allow_YY: True and do not
    coerce to 4-digit years. And parsers that do work with 2-digit
    years may make a different guess about the century than we make
    on the front end. ‘any’: represents any type of data. Defaults to
    ‘any’ if undefined.

  • validation (dict; optional):
    The validation options for user input processing that can
    accept, reject or apply a default value.

    validation is a dict with keys:

    • allow_YY (boolean; optional):
      This is for datetime columns only. Allow 2-digit years
      (default: False). If True, we interpret years as ranging
      from now-70 to now+29 - in 2019 this is 1949 to 2048 but in
      2020 it will be different. If used with action: 'coerce',
      will convert user input to a 4-digit year.

    • allow_null (boolean; optional):
      Allow the use of Noney values. (undefined, None, NaN)
      (default: False).

    • default (boolean | number | string | list | dict; optional):
      The default value to apply with on_change.failure = ‘default’.
      (default: None).

editable (boolean; default False):
If True, then the data in all of the cells is editable. When
editable is True, particular columns can be made uneditable by
setting editable to False inside the columns property. If False,
then the data in all of the cells is uneditable. When editable is
False, particular columns can be made editable by setting editable
to True inside the columns property.

fixed_columns (dict; default { headers: False, data: 0}):
fixed_columns will “fix” the set of columns so that they remain
visible when scrolling horizontally across the unfixed columns.
fixed_columns fixes columns from left-to-right. If headers is
False, no columns are fixed. If headers is True, all operation
columns (see row_deletable and row_selectable) are fixed.
Additional data columns can be fixed by assigning a number to data.
Note that fixing columns introduces some changes to the underlying
markup of the table and may impact the way that your columns are
rendered or sized. View the documentation examples to learn more.

fixed_columns is a dict with keys:

  • data (number; optional):
    Example {'headers':False, 'data':0} No columns are fixed (the
    default).

  • headers (boolean; optional)

fixed_rows (dict; default { headers: False, data: 0}):
fixed_rows will “fix” the set of rows so that they remain visible
when scrolling vertically down the table. fixed_rows fixes rows from
top-to-bottom, starting from the headers. If headers is False, no
rows are fixed. If headers is True, all header and filter rows (see
filter_action) are fixed. Additional data rows can be fixed by
assigning a number to data. Note that fixing rows introduces some
changes to the underlying markup of the table and may impact the way
that your columns are rendered or sized. View the documentation
examples to learn more.

fixed_rows is a dict with keys: