0

I succeed to change the color of a row in a MudBlazor table related to table items condition (followed link). But, when the navigator is in a small size, no background color is affected (white).

<MudTable ... RowClassFunc="@SelectedRowClassFunc">
    ...
</MudTable
     


private string RowStyleFunc(CommandeDTO cmd, int index)
    {
        if (cmd != null && cmd.GetEtatCommande() == EnumEtatTable.Prete)
            return "background-color:#FFCDD2";

        if (cmd != null && cmd.GetEtatCommande() == EnumEtatTable.EnAttente)
            return "background-color:#FFECB3";

        return "background-color:blue";

    }

How to make this condition affect small sizes and mobile navigation?

1 Answers1

0

Be careful, you try to use RowClassFunc here. You should pass to it not the style but the name of a css class. If you want to stay with the implementation you have in your RowStyleFunc method, you should use RowStyleFunc instead of RowClassFunc in the Razor template.

<MudTable ... RowStyleFunc="RowStyleFunc">
...
</MudTable
     


private string RowStyleFunc(CommandeDTO cmd, int index)
{
    if (cmd != null && cmd.GetEtatCommande() == EnumEtatTable.Prete)
        return "background-color:#FFCDD2";

    if (cmd != null && cmd.GetEtatCommande() == EnumEtatTable.EnAttente)
        return "background-color:#FFECB3";

    return "background-color:blue";

}
Dylan El Bar
  • 783
  • 1
  • 14