table icon indicating copy to clipboard operation
table copied to clipboard

PageIndex does not update in controlled component

Open r-s-sandbox opened this issue 6 years ago • 8 comments

rc-v16

##Describe the bug Not sure if this is a bug or whether I have to control page index manually since its a fully controlled component, but triggering a global search or column filter returns results but does not reset page index leading to incorrect pagination behaviour

##To Reproduce Browse to https://codesandbox.io/s/elegant-cherry-fbrei Progress to page 2 Type some text from page 2 in global search input or column filter Pagination says Page 2 of 1

##Expected behavior Page should reset to 1 and pagination should say Page 1 of 2

##Codesandbox! https://codesandbox.io/s/elegant-cherry-fbrei

##Desktop OS: OS 10.14 Browser Latest Chrome Version 81

r-s-sandbox avatar Feb 21 '20 22:02 r-s-sandbox

See https://github.com/tannerlinsley/react-table/issues/1883

zebrahondje avatar Feb 24 '20 08:02 zebrahondje

Issue is still present in version 7.0.0-rc.16

arnoBruynseels avatar Feb 24 '20 14:02 arnoBruynseels

Fixed in bfcc08e7eb66d0bb86bbda0d3f40cf2319e304b3

tannerlinsley avatar Mar 09 '20 12:03 tannerlinsley

@tannerlinsley I have a similar kind of issue, i have implemented redux to store the pageIndex value as i am using multiple instances of react table, as i want to maintain state for each react table. When i click on next page i dispatch an action to store the pageIndex value in reducer. When i navigate to second page and if i apply global filter then the pageCount shows 2 of 1. The pageIndex is set to 1, and doesn't update on filtering the values.

codesandbox - https://codesandbox.io/s/relaxed-chebyshev-4r3up?file=/src/App.js

react-table version : 7.7.0 Thanks!

karnamanirudh avatar Jul 20 '21 13:07 karnamanirudh

I still have this issue with react-table v7.7.0 when using manualPagination with server-side data fetch.

If I have multiple pages of data, I go to page 3 for example, then search for something, and get only one row as a result, pageIndex is not updated, pageIndex is still = 2, expecting it to update pageIndex to 0. I have to manually gotoPage(0) when searching. Anything I am missing?

image

sergecheban avatar Jun 22 '22 15:06 sergecheban

@sergecheban autoResetPage: false option should help here.

Develer avatar Jan 30 '24 16:01 Develer

Does not seem to help, but I think that might be the desired behavior when using manualPagination for most people.

sergecheban avatar Jan 30 '24 16:01 sergecheban

this is still an issue

Sadeghbayan avatar Jul 26 '24 13:07 Sadeghbayan