MCPcopy Create free account
hub / github.com/bvaughn/react-virtualized / GridImperativeAPI

Interface GridImperativeAPI

lib/components/Grid/types.ts:470–560  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468
469/** Public (imperative) methods of a `Grid` (its ref handle). */
470export interface GridImperativeAPI {
471 /**
472 * Forcefully re-render the `Grid` (and its visible cells),
473 * e.g. because the data rendered by `cellRenderer` has changed but the `Grid`'s props have not.
474 */
475 forceUpdate(): void;
476
477 /**
478 * Gets offsets for a given cell and alignment (see `scrollToCell` for the alignment values).
479 * The alignment defaults to "auto"; an index of `-1` (the default) refers to the last column or row.
480 */
481 getOffsetForCell(params?: {
482 alignment?: Alignment;
483 columnIndex?: number;
484 rowIndex?: number;
485 }): { scrollLeft: number; scrollTop: number };
486
487 /**
488 * Gets estimated total rows' height.
489 */
490 getTotalRowsHeight(): number;
491
492 /**
493 * Gets estimated total columns' width.
494 */
495 getTotalColumnsWidth(): number;
496
497 /**
498 * This method handles a scroll event originating from an external scroll control.
499 * It's an advanced method and should probably not be used unless you're implementing a custom scroll-bar solution.
500 */
501 handleScrollEvent(params: ScrollPosition): void;
502
503 /**
504 * Invalidate the size of a cell and recompute visible cells after the current render has been committed.
505 * This is a deferred version of `recomputeGridSize()` (batching the invalidations of a render);
506 * it is intended for advanced use-cases like `CellMeasurer`.
507 */
508 invalidateCellSizeAfterRender(params: CellPosition): void;
509
510 /**
511 * Pre-measure all columns and rows in a `Grid`.
512 *
513 * Typically cells are only measured as needed and estimated sizes are used for cells that have not yet been measured.
514 * This method ensures that the next call to getTotalSize() returns an exact size (as opposed to just an estimated one).
515 */
516 measureAllCells(): void;
517
518 /**
519 * Recomputes row heights and column widths after the specified index (both default to 0).
520 *
521 * This function should be called if dynamic column or row sizes have changed but nothing else has.
522 * Since `Grid` only receives `columnCount` and `rowCount` it has no way of detecting when the underlying data changes.
523 *
524 * This method will also force a render cycle to ensure that the updated measurements are reflected in the rendered grid.
525 */
526 recomputeGridSize(params?: { columnIndex?: number; rowIndex?: number }): void;
527

Callers 22

forceUpdateGridFunction · 0.65
forceUpdateGridFunction · 0.65
Grid.test.tsxFile · 0.65
getOffsetForRowFunction · 0.80
getOffsetForRowFunction · 0.80
Grid.test.tsxFile · 0.80
Grid.test.tsxFile · 0.80
Grid.test.tsxFile · 0.80
onScrollFunction · 0.80
Grid.test.tsxFile · 0.80
onScrollFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected