In my material table, I need to apply specific CSS classes based on the content of the cell. https://i.sstatic.net/YN6EO.png
These are the CSS classes that I am using
.status-code{
flex: 0 0 10% !important;
width: 10% !important;
}
.status-code-success{
flex: 0 0 10% !important;
width: 10% !important;
background: rgb(196,214,160);
color: rgb(80,99,42);
}
.status-code-failed{
flex: 0 0 10% !important;
width: 10% !important;
background: rgb(229,185,181);
color: rgb(97,38,33);
}
.status-code-empty{
flex: 0 0 10% !important;
width: 10% !important;
background: rgb(216,216,216);
}
Below is the HTML code snippet
<ng-container matColumnDef="Warehouse">
<mat-header-cell class="status-code" *matHeaderCellDef> Warehouse </mat-header-cell>
<mat-cell class="{{row.warehouse}} == 'Success' ? status-code-success : ({{row.warehouse}} == 'Failed' ? status-code-failed : status-code-empty)" *matCellDef="let row"> {{row.warehouse}} </mat-cell>
</ng-container>
<ng-container matColumnDef="DPI">
<mat-header-cell class="status-code" *matHeaderCellDef> DPI </mat-header-cell>
<mat-cell class="{{row.dpi}} == 'Success' ? status-code-success : ({{row.dpi}} == 'Failed' ? status-code-failed : status-code-empty)" *matCellDef="let row"> {{row.dpi}} </mat-cell>
</ng-container>
However, when I have only one row with 'Success' in the Warehouse cell, it shows up with a pink background.
https://i.sstatic.net/QW8Rt.png
I'm not sure what's causing this issue. Can someone please help me figure out what might be wrong?