dash icon indicating copy to clipboard operation
dash copied to clipboard

[BUG] Filtering for numeric column breaks if filtering is case insensitive

Open ammaar8 opened this issue 4 years ago • 1 comments

Filtering for numeric columns breaks if we set column filtering to be case insensitive. This can be checked on https://dash.plotly.com/datatable/interactivity. If the toggle is set to be case sensitive, it filters correctly but as soon as I change it to be insensitive it breaks. This prevents us from setting filter_options={'case': 'insensitive'} and hide the toggle button since the filter won't work correctly. I think case sensitivity should be ignored if the column type is numeric or we can just always filter it with case sensitivity?

Datatable Case Sensisitivity Breaks filtering demo

ammaar8 avatar Oct 05 '21 09:10 ammaar8

Had the same problem, I wanted to set filter_options={'case': 'insensitive'} and hide the button but the numeric filtering was wrong, I solved this by setting the "filter_options" for each column instead of using the table-level "filter_options", for example:

columns = [{
       "name": "continent"
       , "id": "continent"
       , "type": "text
       , "filter_options": {"case": "insensitive"}
},
{
       "name": "lifeExp"
       , "id": "lifeExp"
       , "type": "numeric"
       , "filter_options": {"case": "sensitive"}
}
]

Docs Reference

I hid the button using CSS:

input.dash-filter--case {
    display: none; 
 }

gpedro178 avatar May 27 '22 15:05 gpedro178