diff --git a/packages/react-bootstrap-table2-example/examples/pagination/custom-page-list-with-search.js b/packages/react-bootstrap-table2-example/examples/pagination/custom-page-list-with-search.js index 87d5d74..257a25b 100644 --- a/packages/react-bootstrap-table2-example/examples/pagination/custom-page-list-with-search.js +++ b/packages/react-bootstrap-table2-example/examples/pagination/custom-page-list-with-search.js @@ -7,7 +7,7 @@ import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit'; import Code from 'components/common/code-block'; import { productsGenerator } from 'utils/common'; -const products = productsGenerator(21); +const products = productsGenerator(40); const { SearchBar } = Search; const columns = [{ @@ -24,61 +24,12 @@ import paginationFactory, { PaginationProvider, PaginationListStandalone } from import filterFactory, { textFilter } from 'react-bootstrap-table2-filter'; class Table extends React.Component { - render() { - const options = { - custom: true, - paginationSize: 4, - pageStartIndex: 1, - firstPageText: 'First', - prePageText: 'Back', - nextPageText: 'Next', - lastPageText: 'Last', - nextPageTitle: 'First page', - prePageTitle: 'Pre page', - firstPageTitle: 'Next page', - lastPageTitle: 'Last page', - showTotal: true, - totalSize: products.length - }; - const contentTable = ({ paginationProps, paginationTableProps }) => ( -
- -
-
- -
-
- -
- ); + state = { products } - return ( -
-

PaginationProvider will care the data size change. You dont do anything

- - { contentTable } - - { sourceCode } -
- ); + loadData = () => { + this.setState({ products: productsGenerator(17) }); } -} -`; -export default class Table extends React.Component { render() { const options = { custom: true, @@ -93,15 +44,84 @@ export default class Table extends React.Component { firstPageTitle: 'Next page', lastPageTitle: 'Last page', showTotal: true, - totalSize: products.length + totalSize: this.state.products.length }; const contentTable = ({ paginationProps, paginationTableProps }) => (
+ + { + toolkitprops => ( +
+ + +
+ ) + } +
+ +
+ ); + + return ( +
+

PaginationProvider will care the data size change. You dont do anything

+ + { contentTable } + + { sourceCode } +
+ ); + } +} +`; + +export default class Table extends React.Component { + state = { products } + + loadData = () => { + this.setState({ products: productsGenerator(17) }); + } + + render() { + const options = { + custom: true, + paginationSize: 4, + pageStartIndex: 1, + firstPageText: 'First', + prePageText: 'Back', + nextPageText: 'Next', + lastPageText: 'Last', + nextPageTitle: 'First page', + prePageTitle: 'Pre page', + firstPageTitle: 'Next page', + lastPageTitle: 'Last page', + showTotal: true, + totalSize: this.state.products.length + }; + const contentTable = ({ paginationProps, paginationTableProps }) => ( +
+ + + {