Row Styling
Row Styling
rowStyleto add styles to all rows.getRowStylecallback to conditionally add styles.rowClassto set the classes for all rows.getRowClasscallback to conditional add class.rowClassRulesto add and remove classes.
Configuration
Let's look at how you use the props for row styling.
export default function Grid() {
return (
<AgGridReact
columnDefs={columnDefs}
getRowClass={getRowClass}
rowClass={rowClass}
rowClassRules={rowClassRules}
rowStyle={{ color: '#fff', 'background-color': '#37474f' }}
/>
);
}
const rowClassRules = {
'row-highlight': ({ data }) => data.total > 100,
'row-danger': ({ data }) => data.dateOfOrder.getFullYear() < 2019,
};
const getRowClass = ({ data }) => {
return data.total > 2000 ? 'row-highlight' : '';
};