You can add the following example to docs to show how you can have the datagrid fit to the size of the container:
const wrapper = useRef(null);
const [dimensions, setDimensions] = useState({
height: 300,
width: 1000,
});
const calcHeight = () => {
if (wrapper?.current) {
const rect = wrapper.current.getBoundingClientRect();
setDimensions({
height: rect.height,
width: rect.width,
});
}
};
useEffect(() => {
window.addEventListener("resize", calcHeight);
}, []);
useEffect(() => {
calcHeight();
}, [wrapper, wrapper?.current]);
return (
<div ref={wrapper}>
<DataEditorContainer width={dimensions.width} height={dimensions.height}>
<DataEditor
rowMarkers={false}
cellXOffset={0}
showTrailingBlankRow={false}
allowResize={true}
getCellContent={getData}
columns={getColumns()}
rows={1000}
/>
</DataEditorContainer>
</div>
);
}