cellStyle
Description
Optional. Defines the style of a cell in the tableUsage
cellStyle?: (row:any,column: IColumn) => string;
Parameters
The property is a function that takes the following parameters:
row
- an object with the row configuration, where key is the row ID:
{
[key: string]: any;
}
column
- an object with the column configuration parameters. All parameters description you can find here:columns
The function returns the name of a CSS class or an empty string.
Example
import { useState } from "react";
import { getData } from "./common/data";
import { Grid } from "@svar-ui/react-grid";
function Example() {
const { data, columns } = getData();
return (
<Grid
data={data}
columns={columns}
cellStyle={(row, col) =>
row.id === 14 && col.id === "lastName" ? "cellStyle" : ""
}
/>
);
}
.rowStyle:not(.wx-selected) .wx-cell:not(.cellStyle) {
color: white;
background: #457b9d;
}
.columnStyle {
text-decoration: underline;
}
Related articles: columns