[Python] Python Dash AgGrid- Applying styling to blank cells?

Discussão em 'Python' iniciado por Stack, Março 14, 2025.

  1. Stack

    Stack Membro Participativo

    I have a python dash app and am applying conditional formatting to cells depending on if their values are less than (green) or greater than (red) specified values. Some of my cells are blank and it is taking them as being less than the specified value and highlighting them green.

    I'd like for blank cells to remain as default. Below is an example snippet.

    {"field":"Display name"},
    {"field":"Adult Head",
    'cellStyle': {"styleConditions": [{"condition": "params.value <= 880","style": {"backgroundColor": "#16F529"}},
    {"condition": "params.value > 880","style": {"backgroundColor": "#FD1C03"}}]}},


    I tried to also add a condition on null cells:

    {"condition": "params.value == null","style": {"backgroundColor": "#FFFFFF"}}


    But this does nothing. These blanks are nan's in the dataframe being read in. I don't know javascript so perhaps I'm just not setting the correct check?

    Thanks for any input.

    Continue reading...

Compartilhe esta Página