Black Lives Matter. Please consider donating to Black Girls Code today.

Enabling sorting for Data Table that starts out blank

I have an app that has a data table that starts out blank but has columns. An app callback will fill the table after a user specifies a parameter. I want to enable sorting as well, however, I’m running into issues:

  1. TypeError: Unexpected keyword argument sort_action

Is this because the Data Table is blank to begin with?

Bumping this for visibility

@frobro989

Using dash==1.6.0 (dash-table==4.5.0) with:

import dash
from dash_table import DataTable

app = dash.Dash(__name__)

app.layout = DataTable(
    id='table',
    columns=[{
        'name': x,
        'id': x,
        'selectable': True
    } for x in ['a', 'b', 'c', 'd', 'e', 'f']],
    data=[],
    sort_action='native'
)

if __name__ == '__main__':
    app.run_server(debug=True)

I get no error. Please confirm the dash and dash-table versions you are using. sort_action was added in 4.0.0. If using a compatible version, can you provide an app example that displays the error?