Skip to content

Data Grid - Scrolling

This section presents how to programmatically control the scroll.

Scrolling to specific cells

You can scroll to a specific cell by calling apiRef.current.scrollToIndexes(). The only argument that must be passed is an object containing the row index and the column index of the cell to scroll. If the row or column index is not present, the grid will not do any movement in the missing axis.

The following demo explores the usage of this API:

Desk
Commodity
Trader Name
Trader Email
Quantity
Filled Quantity
Is Filled
Status
D-331
Frozen Concentrated Orange Juice
Lulu Page
72,003
48.27 %
no
Filled
D-1
Sugar No.14
Helena Bailey
40,313
6.199 %
no
Open
D-1429
Wheat
Todd Hall
31,215
37.568 %
no
Filled
D-3874
Sugar No.11
Maria Klein
97,308
47.98 %
no
Rejected
D-5082
Rough Rice
Lucille Diaz
88,803
10.13 %
no
Filled
D-6806
Robusta coffee
Jorge Evans
36,333
53.329 %
no
Partially Filled
D-3401
Sugar No.14
Helena Warner
87,912
32.13 %
no
Filled
D-8527
Frozen Concentrated Orange Juice
Dollie Powers
64,915
49.569 %
no
Partially Filled
D-5831
Cotton No.2
Herman Glover
13,187
60.241 %
no
Open
D-7879
Wheat
Georgia Roy
66,766
79.31 %
no
Partially Filled

apiRef

⚠️ Only use this API as the last option. Give preference to the props to control the grid.

Signature:
getScrollPosition: () => GridScrollParams
Signature:
scroll: (params: Partial<GridScrollParams>) => void
Signature:
scrollToIndexes: (params: Partial<GridCellIndexCoordinates>) => boolean