✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
📊 Dash 2.0 is Arriving. Register here.

Dash Table columns conditional


Please, tell me, when forming a table from a dataframe, what type of data should be set for a column with numeric values, now filtering does not work if the columns are formed in the following way:

columns=[{"name": i, "id": i} for i in df.columns],

as soon as I set the type this way the filtering starts working

columns=[{'id': 'id',
              'name': 'id', 'type': 'numeric'}],

is there any way to fix this without listing all columns in ‘columns’ wit the datatype?
any help and tips

Hi @dilfin07

You can include it like this:

columns=[{"name": i, "id": i, "type": "numeric"} for i in df.columns]

However, it should not be necessary to do that for the filtering to work. You can see it working without setting the type to numeric in the example on this page: Sorting, Filtering, Selecting, and Paging Natively | Dash for Python Documentation | Plotly