I want to style cells that custom validate false (for example value less then zero) in red. All others should remain in default style.
How can i achieve this ?
I tried with
optionsData=
{
rowStyle: rowData => ({
backgroundColor: (rowData.price<0) ? 'red' : 'green'
})
}
This will highlight the complete row red. I just want the cells that have condition false to be red.
Can you help me with this issue ?
Hi @AlexandruPavel8
You can use cellStyle inside you column definition.
{
title: 'title',
field: 'field',
cellStyle: rowData => ({ // your style. })
}
@mbrn but If I want to change all row style?
How can I do this?
components={{
Row: rowProps => <MTableBodyRow {...rowProps} className={MyFUNCTION} />
} ,
.....
}
In the previous version of lib, I've used something like this, but it doesn't work in the actual version.
Most helpful comment
Hi @AlexandruPavel8
You can use cellStyle inside you column definition.
{
title: 'title',
field: 'field',
cellStyle: rowData => ({ // your style. })
}