You were really close in your StackBlitz. All the rows were green because you were not deciding anything based on your row data. You were always returning true
(which means it always uses the same class). If you return one or more class names based on a condition, you would get the desired result.
Classes
/deep/ .row-color1 {
background-color: rgb(96, 212, 96);
}
/deep/ .row-color2 {
background-color: rgb(51, 201, 228);
}
getRowClass() Typescript function
getRowClass = (row) => {
return {
'row-color1': row.gender == "Male",
'row-color2': row.gender == "Female",
};
}
Here i am returning two classes based on two conditions. The ngx-datable API documentation says that you can return either an object or a string (the above example being an object returned).
I have created a new stackblitz with the fix (forked on yours)