Skip to content

PaginationListStandalone not working right with Filter #778

@jrvaldiviaffdc

Description

@jrvaldiviaffdc

Hi Allen! I've been trying yo use the Standalone component for the pagination on a Table that is not using the remote mode but I've found that, when used with the filter, it doesn't recognize the prop totalSize automatically as it used to

This is a simple demonstration of what I have

import React, { Component } from 'react';
import BootstrapTable from 'react-bootstrap-table-next';
import paginationFactory, { PaginationProvider, PaginationListStandalone } from 'react-bootstrap-table2-paginator';
import cellEditFactory from 'react-bootstrap-table2-editor';
import filterFactory from 'react-bootstrap-table2-filter';

const
	columns = [{
		dataField: 'id',
		text: 'Product ID',
		filter: textFilter({
			placeholder: 'Enter Value',
			getFilter: (filter) => this.addFilter('Identifier', type, filter, '')
		})
	}, {
		dataField: 'name',
		text: 'Product Name',
		filter: textFilter({
			placeholder: 'Enter Value',
			getFilter: (filter) => this.addFilter('IdentifierParent', type, filter, '')
		})
	}],

	products = [{
		Id =1,
		Name ='product 1'
	}, {
		Id =2,
		Name ='product 2'
	}, {
		Id =3,
		Name ='product 3'
	}];

class Table extends Component {
	constructor(props) {
		super(props);
	}

	render() {
		let
			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,
			}
		contentTable = ({ paginationProps, paginationTableProps }) => {
			return (<div>

				<PaginationListStandalone
					{...paginationProps}
				/>
				<div>
					<div>
						<BootstrapTable
							keyField='Id'
							data={products}
							columns={columns}
							filter={filterFactory()}
							cellEdit={cellEditFactory(this.props.editOptions)}
							striped
							hover
							{...paginationTableProps}
						/>
					</div>
				</div>
				<PaginationListStandalone
					{...paginationProps}
				/>
			</div>);
		};
		return (
			<div>
				<PaginationProvider
					pagination={
						paginationFactory(options)
					}
				>
					{contentTable}
				</PaginationProvider>
			</div >
		);
	}
}

export default Table;

Is there a way to fix it or it not support yet?
Thank you for your hard work!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions