Dash table filtering not working with spaces in header

I have looked through the forum and github but haven’t found anything regarding this issue. My apologies if I have missed it.

The filtering function of the data tables does not seem to work if the column name contains spaces:

import dash
import dash_table
import dash_html_components as html
import pandas as pd

vals = list('aabbbcc')
df = pd.DataFrame({'nospace': vals, 'yes space ': vals})

app = dash.Dash(__name__)

app.layout = html.Div([
            {"name": i, "id": i, "deletable": True} for i in df.columns

if __name__ == '__main__':

It is trivial to remove the spaces, but I figured I would post in case anyone knew of a workaround, or perhaps I am doing something wrong without realizing it.

Thanks for all the great work!

Thanks John for asking this question. I was surprised that I didn’t find any answer to this issue either. And it seems like the filter not only doesn’t support space in header, but also special characters like “-” or “&”. Has anyone have some work around to solve this?

I feel like dash-table-experienment does a better job at filtering. However, the horizontal scrolling bar doesn’t work in Chrome.


Late in answering this but just to let you know that this should be working now with dash-table>=3.7.0

1 Like