import paginationFactory, { PaginationProvider, PaginationListStandalone } from 'react-bootstrap-table2-paginator';
import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit';
import { tableData } from '../../../data/blog/BlogPostData';
const columns = [
{ dataField: 'id', text: 'Id' },
{ dataField: 'category', text: 'Category' },
{ dataField: 'slug', text: 'Slug' },
{ dataField: 'posts', text: 'Posts' },
{ dataField: 'date_created', text: 'Date Created' },
{ dataField: 'date_updated', text: 'Date Updated' },
];
const options = {
custom: true,
paginationSize: 4,
pageStartIndex: 1,
firstPageText: 'First',
prePageText: 'Prev',
nextPageText: 'Next',
lastPageText: 'Last',
nextPageTitle: 'First page',
prePageTitle: 'Pre page',
firstPageTitle: 'Next page',
lastPageTitle: 'Last page',
showTotal: true,
totalSize: tableData.length
};
const contentTable = ({ paginationProps, paginationTableProps }) => (
<div>
<ToolkitProvider
keyField="id"
columns={ columns }
data={ tableData}
search
>
{
toolkitprops => (
<div className="post-table">
<SearchBar { ...toolkitprops.searchProps } className="search-bar m-4" placeholder="Search Post" />
<div className="table-responsive">
<BootstrapTable
selectRow={ selectRow }
bordered={ false }
{ ...toolkitprops.baseProps }
{ ...paginationTableProps }
/>
</div>
</div>
)
}
</ToolkitProvider>
<PaginationListStandalone { ...paginationProps } />
</div>
);
const BlogPost= () => {
return (
<Fragment>
<PaginationProvider
pagination={
paginationFactory(options)
}
>
{ contentTable }
</PaginationProvider>
</Fragment>
)
};
export default BlogPost;
Hi Allen,
The bug
I want all these functionalities in single table searching in all fields + paging, it works fine for the first time, but after navigating to another page and searching for something generates error. for your reference have added code snippet and error,
Code Snippet
To Reproduce
Steps that generate errors:
Error Screenshots
If applicable, add screenshots to help explain your problem.