Skip to main content

Scroll to cell

To scroll to a row, column or both (a cell), get a handle to the imperative API:

const gridApi = useRef<GridApi>()

<DataGrid
gridApi={gridApi}
// ...
/>

On a user interaction you can then scroll to a particular row and/or column:

gridApi.current.scrollTo({ rowKey: 'someRowKey' }) // Vertical scroll
gridApi.current.scrollTo({ columnKey: 'someColumnKey' }) // Horizontal scroll
gridApi.current.scrollTo({ rowKey: 'someRowKey', columnKey: 'someColumnKey' }) // Scroll both
View Source