DataTable error: Invalid argument `fixed_columns` passed into DataTable

I get this error:

Invalid argument `fixed_columns` passed into DataTable with ID "sys_table".
Value provided: 
[
  {
    "headers": true,
    "data": 1
  }
]

With this code:

    table = dash_table.DataTable(
        id=table_name,
        columns=[{"name": name, "id": col} for name, col in zip(headers,
                                                               df_columns)],
        fixed_rows = {'headers': True, 'data': 0},
        fixed_columns = {'headers': True, 'data': 1},
        data=df.to_dict('records'),
        fill_width=True,
        row_selectable=row_selectable,
        filter_action="native",
        sort_action="native",
        sort_mode="multi",
        style_cell_conditional=[{"if": {"column_id": "Specs"},
                                 "textAlign": "left"}],
        style_table={'overflowX': 'scroll', 'maxHeight': '600px',
                     'maxWidth': '1500px', 'overflowY': 'scroll'},
        style_cell={"padding": '0 2rem', 'border': 'none', 'minWidth': '200px',
                    'width': 'auto', 'height': 'auto', 'whiteSpace': 'normal'},
        style_header={'font_size': '20px', 'text_align': 'left',
                      'backgroundColor': colors['table_header_background'],
                      'color': colors['bright_text'], 'fontWeight': 'bold'},
        style_data={'font_size': '18px', 'text_align': 'left',
                    'backgroundColor': colors['table_background_1'],
                    'color': colors['bright_text']},
        style_data_conditional=[{'if': {'row_index': 'odd'},
                                 'backgroundColor': colors[
                                     'table_background_2']}],
    )
    

I am using dash-table v. 4.11.0. I am following the guidelines in DataTable docs. What am I doing wrong?

Hi diegos,
I don’t see any wrong in 'fixed_columns = {‘headers’: True, ‘data’: 1}'
If you remove that property, is the table shown as expected?

If I remove the property it the error disappears but the tables first column and row are not fixed. If I pass an empty dict:

fixed_columns = {}

also no error and no fixed col and row.

Sorry, you are saying that if you remove only the ‘fixed_column’ the ‘fixed_row’ do nothing? it do not fix the headers?

correct, it doesn’t seem to work at all.

:thinking: so strange!
Now you know that you have two problems instead of one. :grinning_face_with_smiling_eyes:
I thought perhaps the problem was to use both together but even with one is not working.
I have no clue. Sorry.

Change the fix_row to fixed_rows={‘headers’: True},

Hi @diegos

Just to make sure everything is set up right - try running this minimal working example:

import dash
import dash_table
import pandas as pd

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv')

app = dash.Dash(__name__)

app.layout = dash_table.DataTable(
    id='table',
    columns=[{"name": i, "id": i} for i in df.columns],
    data=df.to_dict('records'),
    fixed_columns = {'headers':True, 'data':1},
    fixed_rows = {'headers': True, 'data': 1},
)

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

If this works, then try checking the callback (I’m assuming you are using a callback to update the fixed_columns ). You will get this error if you return this:

[{'headers':True, 'data':1}]

If it still doesn’t work, try posting a minimal example that reproduces the error - complete with some sample data, and someone might be able to see what’s wrong.

Hopefully this will help :slight_smile:

I have same issue

Invalid argument fixed_columns passed into DataTable with ID “table”.
Value provided:
{
“header”: True,
“data”: 1
}

In my case, I am passing an empty list of dictionary until a selection is made by the user using box select. I tried using try except method but I am not sure how to implement it on dash.
This only happens when I am debugging.

Did anyone find the cause and solution to this issue?

Regards

Just to make sure, you passed header or headers to the columns?

It needs to be headers if you didn’t pass that.

Thanks for the correction. It fixed my problem!

1 Like