Custom color for a cell in data grid #596
-
How do I add a custom color to a cell in a table based on some condition? Till now I only found ways to add custom color to rows or columns. |
Beta Was this translation helpful? Give feedback.
Answered by
nzbin
Nov 1, 2023
Replies: 1 comment
-
https://ng-matero.github.io/extensions/components/grid/overview#custom-class-for-row-and-column columns: MtxGridColumn[] = [
{ header: 'ID', field: 'id' },
{ header: 'name', field: 'name' },
{
header: 'weight',
field: 'weight',
class: (data) => {
return data?.weight > 10 ? 'danger' : data?.weight > 5 ? 'warning' : '';
},
},
{
header: 'gender',
field: 'gender',
class: (data) => {
return data?.gender === 'male' ? 'info' : '';
},
},
{ header: 'mobile', field: 'mobile' },
]; |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
rahulpd101
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://ng-matero.github.io/extensions/components/grid/overview#custom-class-for-row-and-column