Skip to content

Commit 7c131ca

Browse files
committed
Document overscanIndicesGetter property
1 parent 3958248 commit 7c131ca

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docs/Grid.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ A windowed grid of elements. `Grid` only renders cells necessary to fill itself
2222
| onSectionRendered | Function | | Callback invoked with information about the section of the Grid that was just rendered. This callback is only invoked when visible rows have changed: `({ columnOverscanStartIndex: number, columnOverscanStopIndex: number, columnStartIndex: number, columnStopIndex: number, rowOverscanStartIndex: number, rowOverscanStopIndex: number, rowStartIndex: number, rowStopIndex: number }): void` |
2323
| onScroll | Function | | Callback invoked whenever the scroll offset changes within the inner scrollable region: `({ clientHeight: number, clientWidth: number, scrollHeight: number, scrollLeft: number, scrollTop: number, scrollWidth: number }): void` |
2424
| overscanColumnCount | Number | | Number of columns to render before/after the visible slice of the grid. This can help reduce flickering during scrolling on certain browsers/devices. |
25+
| overscanIndicesGetter | Function | | Responsible for calculating the number of cells to overscan before and after a specified range [Learn more](#overscanIndicesGetter) |
2526
| overscanRowCount | Number | | Number of rows to render above/below the visible slice of the grid. This can help reduce flickering during scrolling on certain browsers/devices. |
2627
| rowCount | Number || Number of rows in grid. |
2728
| rowHeight | Number or Function || Either a fixed row height (number) or a function that returns the height of a row given its index: `({ index: number }): number` |
@@ -147,6 +148,10 @@ function cellRangeRenderer ({
147148
}
148149
```
149150

151+
### overscanIndicesGetter
152+
This is an advanced property.
153+
This function is responsible for calculating the number of cells to overscan before and after a specified range. By default, React Virtualized optimizes the number of cells to overscan based on scroll direction. If you'd like to customize this behavior, you may want to fork the [`defaultOverscanIndicesGetter`](https://github.com/bvaughn/react-virtualized/blob/master/source/Grid/utils/defaultOverscanIndicesGetter.js) function.
154+
150155
### cellRenderer
151156

152157
Responsible for rendering a single cell, given its row and column index.
@@ -173,15 +178,15 @@ function cellRenderer ({
173178
// Style is required since it specifies how the cell is to be sized and positioned,
174179
// and React Virtualized depends on this sizing/positioning for proper scrolling behavior.
175180
// By default, the grid component specifies, calculates, and initializes the following style properties:
176-
// height
177-
// width
181+
// height
182+
// width
178183
// left
179184
// top
180185
// position
181186
// You can add additional class names or style properties as you would like.
182187
// Key is also required by React to more efficiently manage the array of cells.
183188
return (
184-
<div
189+
<div
185190
key={key}
186191
style={style}
187192
>

0 commit comments

Comments
 (0)