diff --git a/packages/react-table/src/docs/demos/Table.md b/packages/react-table/src/docs/demos/Table.md index c1017e7d34a..d7983c9f8b5 100644 --- a/packages/react-table/src/docs/demos/Table.md +++ b/packages/react-table/src/docs/demos/Table.md @@ -1546,28 +1546,32 @@ To demonstrate this, navigate to the last page of data below using the `>>` navi - The default behavior would show the last page of results, which would only contain the last two rows (rows 11 - 12). - The `isLastFullPageShown` prop navigates you back to the previous page which does contain a full page of 5 rows (rows 6 - 10). -```js +```js isFullscreen import React from 'react'; import { Pagination } from '@patternfly/react-core'; -import { Table as TableDeprecated, TableHeader, TableBody } from '@patternfly/react-table/deprecated'; +import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table'; class ComplexPaginationTableDemo extends React.Component { constructor(props) { super(props); - this.columns = [{ title: 'First column' }, { title: 'Second column' }, { title: 'Third column' }]; + this.columns = { + firstColumn: 'First column', + secondColumn: 'Second column', + thirdColumn: 'Third column' + }, this.defaultRows = [ - { cells: [{ title: 'Row 1 column 1' }, { title: 'Row 1 column 2' }, { title: 'Row 1 column 3' }] }, - { cells: [{ title: 'Row 2 column 1' }, { title: 'Row 2 column 2' }, { title: 'Row 2 column 3' }] }, - { cells: [{ title: 'Row 3 column 1' }, { title: 'Row 3 column 2' }, { title: 'Row 3 column 3' }] }, - { cells: [{ title: 'Row 4 column 1' }, { title: 'Row 4 column 2' }, { title: 'Row 4 column 3' }] }, - { cells: [{ title: 'Row 5 column 1' }, { title: 'Row 5 column 2' }, { title: 'Row 5 column 3' }] }, - { cells: [{ title: 'Row 6 column 1' }, { title: 'Row 6 column 2' }, { title: 'Row 6 column 3' }] }, - { cells: [{ title: 'Row 7 column 1' }, { title: 'Row 7 column 2' }, { title: 'Row 7 column 3' }] }, - { cells: [{ title: 'Row 8 column 1' }, { title: 'Row 8 column 2' }, { title: 'Row 8 column 3' }] }, - { cells: [{ title: 'Row 9 column 1' }, { title: 'Row 9 column 2' }, { title: 'Row 9 column 3' }] }, - { cells: [{ title: 'Row 10 column 1' }, { title: 'Row 10 column 2' }, { title: 'Row 10 column 3' }] }, - { cells: [{ title: 'Row 11 column 1' }, { title: 'Row 11 column 2' }, { title: 'Row 11 column 3' }] }, - { cells: [{ title: 'Row 12 column 1' }, { title: 'Row 12 column 2' }, { title: 'Row 12 column 3' }] } + { firstColumn: 'Row 1 column 1', secondColumn: 'Row 1 column 2', thirdColumn: 'Row 1 column 3' }, + { firstColumn: 'Row 2 column 1', secondColumn: 'Row 2 column 2', thirdColumn: 'Row 2 column 3' }, + { firstColumn: 'Row 3 column 1', secondColumn: 'Row 3 column 2', thirdColumn: 'Row 3 column 3' }, + { firstColumn: 'Row 4 column 1', secondColumn: 'Row 4 column 2', thirdColumn: 'Row 4 column 3' }, + { firstColumn: 'Row 5 column 1', secondColumn: 'Row 5 column 2', thirdColumn: 'Row 5 column 3' }, + { firstColumn: 'Row 6 column 1', secondColumn: 'Row 6 column 2', thirdColumn: 'Row 6 column 3' }, + { firstColumn: 'Row 7 column 1', secondColumn: 'Row 7 column 2', thirdColumn: 'Row 7 column 3' }, + { firstColumn: 'Row 8 column 1', secondColumn: 'Row 8 column 2', thirdColumn: 'Row 8 column 3' }, + { firstColumn: 'Row 9 column 1', secondColumn: 'Row 9 column 2', thirdColumn: 'Row 9 column 3' }, + { firstColumn: 'Row 10 column 1', secondColumn: 'Row 10 column 2', thirdColumn: 'Row 10 column 3' }, + { firstColumn: 'Row 11 column 1', secondColumn: 'Row 11 column 2', thirdColumn: 'Row 11 column 3' }, + { firstColumn: 'Row 12 column 1', secondColumn: 'Row 12 column 2', thirdColumn: 'Row 12 column 3' } ]; this.defaultPerPage = 10; this.state = { @@ -1619,14 +1623,29 @@ class ComplexPaginationTableDemo extends React.Component { } render() { - const rows = this.state.rows.map((row) => ({ cells: row.cells })); return ( {this.renderPagination()} - - - - + + + + + + + + + + {this.state.rows.map((row, rowIndex) => ( + + <> + + + + + + ))} + +
{this.columns.firstColumn}{this.columns.secondColumn}{this.columns.thirdColumn}
{row.firstColumn}{row.secondColumn}{row.thirdColumn}
); } @@ -1770,7 +1789,9 @@ export const TableEmptyState: React.FunctionComponent = () => ( titleText="No results found" headingLevel="h2" /> - No results match this filter criteria. Clear all filters and try again. + + No results match this filter criteria. Clear all filters and try again. +