Hi,
I'm aware there is a cellRender method. There is also a rowRender method.
In our project we allow users to style fields, for example the user might set a specific field/column to have a background colour of red. I do this in the cellRender method.
But what is the user wants to highlight an entire row (so each field/column has a background colour)? I wondered if we could use the rowRender to achieve this.
I have got the desired effect but am wondering if this is considered bad practice? Is this okay or is it better to add more logic to the cellRender method?
const rowRender = (tr, props) => {
// In this basic example, the second row of the grid has all it's cells coloured red. It'll obviously be more complex than this
if (props.dataIndex === 1) {
props.children.forEach((cell, i) => {
props.children[i] = React.cloneElement(cell, {...applyStyle({backgroundColour: '#ff0000'})});
});
...