import { FunctionComponent } from 'react'; import { Caption, Table, TableGridBreakpoint, Td, Th, Thead, Tr } from '@patternfly/react-table'; import { CellMeasurerCache, CellMeasurer } from 'react-virtualized'; import { AutoSizer, VirtualTableBody } from '@patternfly/react-virtualized-extension'; export const VirtualizedExample: FunctionComponent = () => { // this StringArray type is just needed because something in our documentation framework crashes when it encounters // a string[][] type type StringArray = string[]; const rows: StringArray[] = []; for (let i = 0; i < 100; i++) { rows.push([`one-${i}`, `two-${i}`, `three-${i}`, `four-${i}`, `five-${i}`]); } const columns = ['Repositories', 'Branches', 'Pull requests', 'Workspaces', 'Last Commit']; const measurementCache = new CellMeasurerCache({ fixedWidth: true, minHeight: 44, keyMapper: (rowIndex) => rowIndex }); const rowRenderer = ({ index: rowIndex, _isScrolling, key, style, parent }) => ( {columns.map((col, index) => ( {rows[rowIndex][index]} ))} ); return (
{columns.map((col, index) => ( ))}
Simple Table
{col}
{({ width }) => ( )}
); };