MultiGrid.md

November 13, 2019 ยท View on GitHub

MultiGrid

Decorates Grid and adds fixed columns and/or rows. This is already possible using ScrollSync and 2 or more Grids but MultiGrid reduces the boilerplate.

The majority of MultiGrid properties (eg cellRenderer) are relayed to all child Grids. Some properties (eg columnCount, rowCount) are adjusted slightly to supported fixed rows and columns.

Prop Types

PropertyTypeRequired?Description
classNameBottomLeftGridstringOptional custom className to attach to bottom-left Grid element.
classNameBottomRightGridstringOptional custom className to attach to bottom-right Grid element.
classNameTopLeftGridstringOptional custom className to attach to top-left Grid element.
classNameTopRightGridstringOptional custom className to attach to top-right Grid element.
enableFixedColumnScrollbooleanFixed column can be actively scrolled; disabled by default
enableFixedRowScrollbooleanFixed row can be actively scrolled; disabled by default
fixedColumnCountnumberNumber of fixed columns; defaults to 0
fixedRowCountnumberNumber of fixed rows; defaults to 0
onScrollbarPresenceChangeFunctionCalled whenever a horizontal or vertical scrollbar is added or removed from the bottom, right Grid.: ({ horizontal: boolean, size: number, vertical: boolean }): void
styleobjectOptional custom inline style to attach to root MultiGrid element.
styleBottomLeftGridobjectOptional custom inline style to attach to bottom-left Grid element.
styleBottomRightGridobjectOptional custom inline style to attach to bottom-right Grid element.
styleTopLeftGridobjectOptional custom inline style to attach to top-left Grid element.
styleTopRightGridobjectOptional custom inline style to attach to top-right Grid element.
hideTopRightGridScrollbarbooleanOptional hides top-right Grid scrollbar by adding an additional wrapper. Only useful if enableFixedRowScroll is set to true
hideBottomLeftGridScrollbarbooleanOptional hides bottom-left Grid scrollbar by adding an additional wrapper. Only useful if enableFixedColumnScroll is set to true

Public Methods

forceUpdateGrids

Pass-thru that calls forceUpdate on all child Grids.

measureAllCells

Pass-thru that calls measureAllCells on all child Grids.

recomputeGridSize

Pass-thru that calls recomputeGridSize on all child Grids.

Examples

import {MultiGrid} from 'react-virtualized';

function render() {
  return (
    <MultiGrid
      cellRenderer={cellRenderer}
      columnWidth={75}
      columnCount={50}
      fixedColumnCount={2}
      fixedRowCount={1}
      height={300}
      rowHeight={40}
      rowCount={100}
      width={width}
    />
  );
}