I have a react data grid that needs variable row height.
<ReactDataGrid
ref={node => this.grid = node}
enableCellSelect
columns={columnDefs}
rowGetter={this.rowGetter(this)}
rowsCount={this.props.table.length}
rowRenderer={RowRenderer}
rowHeight={50}
rowScrollTimeout={200}
minHeight={550}
minColumnWidth={15}
/>
I am most of the way there using a row renderer and dynamically calculating the row height
class RowRenderer extends React.Component {
setScrollLeft(scrollBy) {
this.refs.row.setScrollLeft(scrollBy);
}
getRowHeight() {
const rowLines = Math.ceil((this.props.row.desc.length + 1) / 150);
return rowLines * 50;
}
render() {
return (
<ReactDataGrid.Row
ref="row"
{...this.props}
height={this.getRowHeight()}
/>
);
}
};
However, scrolling does not work right due to the div created by virtualization is using a fixed row height
https://github.com/adazzle/react-data-grid/issues/671
<div class="react-grid-Canvas" style="position: absolute; top: 0px; left: 0px; overflow-x: auto; overflow-y: scroll; width: 1214px; height: 498px;">
<div>
<div style="height: 600px;"> <!-- always increments by 50px, the initial row height -->
I have tried to find a way how to overload a function handling the scrolling, but have not found a way to do this. Is there a way to overload the scrolling and set the height so it scrolls smoothly?