Closed MGMehdi closed 2 years ago
Well, thanks I guess ?
@MGMehdi @petyosi did you find a solution? I'm trying to make hover to row and call an action when hover
One way to retrieve the row's data is to use the "context", and get the index of the row using a data attribute:
TableRow: React.forwardRef((props, ref) => {
const { context: { data, }, ...otherProps } = props;
const index = props['data-index'];
const item = data[index];
return (
<TableRow {...otherProps} />
);
})
And in your virtuoso table:
<TableVirtuoso
context={{ data, }}
data={data}
itemContent={renderRow} />
Discussed in https://github.com/petyosi/react-virtuoso/discussions/683