Hi All,
I’m trying to use style_data_conditional to highlight blank cells in red to alert the user of my dash app in case they’ve missed data. I’ve tried to write the code to handle both empty string and None, since both can be generated through blank data. This can be summarized as follows:
- entering the cell, deleting the contents, then pressing return, gives an empty string.
- clicking once on the cell, pressing delete and then return, gives None
I’ve tried to use the following code below to handle both cases, but I can’t work out how to get style_data_conditional to take None - it instead takes the string “None”. Does anyone know how I can enter None for this?
See images below showing the table and df illustrating the None issue, and style_data_conditional treating None as a string, with the code snippet below.
style_data_conditional=[
{
"if": {
'column_id':'Process',
"filter_query": '{Process} eq ""'
},
"backgroundColor": "red",
},
{
"if": {
'column_id':'Task',
"filter_query": '{Task} eq ""'
},
"backgroundColor": "red",
},
{
"if": {
'column_id':'Time',
"filter_query": '{Time} eq ""'
},
"backgroundColor": "red",
},
{
"if": {
'column_id':'Process',
"filter_query": '{Process} eq None'
},
"backgroundColor": "red",
},
{
"if": {
'column_id':'Task',
"filter_query": '{Task} eq None'
},
"backgroundColor": "red",
},
{
"if": {
'column_id':'Time',
"filter_query": '{Time} eq None'
},
"backgroundColor": "red",
},
],
#above = code for when bug fix occurs