I wanted to display the undefined or null values as italicize
. If its empty string then output as is. If it has a value then output as is.
The problem right now is that its outputting as [Object Object] for null or undefined.
Codesandbox: CODESANDBOX
const columns: GridColDef[] = [
{ field: "id", hide: true },
{
field: "col1",
headerName: "Column 1",
width: 150,
renderCell({ value }) {
return `${
value === null || value === undefined ? (
<div style={{ fontStyle: "italic" }}>null</div>
) : (
String(value)
)
}`;
}
},
{
field: "col2",
headerName: "Column 2",
width: 150,
renderCell({ value }) {
return `${
value === null || value === undefined ? (
<div style={{ fontStyle: "italic" }}>null</div>
) : (
String(value)
)
}`;
}
}
];