【发布时间】:2018-01-22 17:42:09
【问题描述】:
我有几个并排的网格,首先我想使用 CellMeasurer 动态计算行高,如何在另一个网格中重用 CellMeasurerCache(同步单元格高度/宽度)?
class App extends React.Component {
constructor(props) {
super(props);
this.leftHeadersCellMeasurerCache = new CellMeasurerCache({
fixedWidth: true,
minHeight: 40
});
}
render() {
return (
<ScrollSync>
{({scrollTop, onScroll}) => (
<div className="row">
<LeftGrid
width={300}
height={500}
scrollTop={scrollTop}
cellMeasurerCache={this.leftHeadersCellMeasurerCache}
/>
<DataGrid
width={400}
height={500}
onScroll={onScroll}
rowHeight={this.leftHeadersCellMeasurerCache.rowHeight}
/>
</div>
)}
</ScrollSync>
)
}
}
PS。很遗憾不能使用 MultiGrid,左侧的数据“不均匀”。
【问题讨论】: