react-bootstrap-table / react-bootstrap-table2

Next Generation of react-bootstrap-table
https://react-bootstrap-table.github.io/react-bootstrap-table2/
MIT License
1.27k stars 431 forks source link

Custom Pagination with search errors out #1512

Open prsdcse opened 3 years ago

prsdcse commented 3 years ago

Custom Pagination with search errors out When have a custom pagination with search. Goto the 2 or higher number page in the pagination and copy a column data and paste it in the search bar it errors out.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://react-bootstrap-table.github.io/react-bootstrap-table2/storybook/index.html?selectedKind=Pagination&selectedStory=Custom%20Pagination%20with%20Search&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Factions%2Factions-panel
  2. Click on page 2 of the pagination.
  3. copy 'Item name 15' and paste it in the search text input.
  4. See error

Screenshots PFB the screenshot Screen Shot 2020-11-19 at 10 40 36 AM

codesandbox was able to replicate the issue in the sandbox itself.

prsdcse commented 3 years ago

Any quick workaround will be greatly appreciated.

Matheus-Wendel commented 3 years ago

Any quick workaround will be greatly appreciated.

Hello, I think i found a workaround for this bug, as you pointed out, the bug occurs when you filter the table while you're on a page that wont exist after the filter, so , if you jump to page 1 before filtering the table, i think the page wont crash.

assuming your table is rendered in the same way as the link you posted i think this should fix it

on the body of the class:

  jumpToFirstPage = ({ onPageChange }) => () => {
    onPageChange(1);
  };

and on the BootstrapTable component:

const contentTable = ({ paginationProps, paginationTableProps }) => (
//...
    <BootstrapTable
        //...props
        onDataSizeChange={this.jumpToFirstPage(paginationProps)}
    />
//...
);
DanPresa commented 3 years ago

Hello I noticed the same issue a month ago but nobody has answering me

inDrimm commented 3 years ago

Any quick workaround will be greatly appreciated.

hello, have you tried to downgrade react-bootstrap-table-next to 3.0.1

DracoRunner commented 3 years ago

Facing the same problem , also tried the given solution nothing happen

Please solve this asap

DracoRunner commented 3 years ago

Any quick workaround will be greatly appreciated.

hello, have you tried to downgrade react-bootstrap-table-next to 3.0.1

Tried not working