Comments (8)
Hi @AdeleD ,
Running into some problems trying to mess with the forceSelected prop. I don't entirely understand it. This is my approach right now.
this.state = { pageNum: 30, currentPage: 0, forceSelected: 0 };
someMethod() {
//force it to the first page
this.setState({forceSelected: 0});
}
handlePageClick= (data) => {
this.setState({currentPage: data.selected});
}
render() {
<ReactPaginate clickCallback={this.handlePageClick}
pageNum={this.state.pageNum}
forceSelected={this.state.forceSelected} />
}
Unfortunately this isn't working for me. What can I do to force the selected page in the parent component?
from react-paginate.
Hello ,
Is it possible to update the selected page from another component ?
This is the problem I'm having http://recordit.co/TU5Wy2OI5W
I need the starting page to be at 1 when the ProductSearchForm component changes as it now remembers the last page it was on.
How can I approach this?
from react-paginate.
This is an issue if using react-router. If you push
a navigation event to /paginated/10
and then cancel it in the route's onEnter
(by replace(prevState.location.pathname);
) the pagination updates altough forceSelected stays the same.
So selected
in state does not follow the changes to forceSelected
after handling onPageChange
altough it receives new props.
from react-paginate.
Hi @phaeton2040,
You can pass the currently selected page to react-paginate thanks to the prop called forceSelected
.
<ReactPaginate clickCallback={this.handlePageClick}
pageNum={this.state.pageNum}
forceSelected={4} />
from react-paginate.
@AdeleD , thnx for the answer. Actually it is already done. But it didn't work because I used version 1.0 where there was no 'shouldComponentUpdate' and because of this setting 'forceSelected' property had no effect on updates. I upgraded to 2.0 and now it works fine! Issue may be closed
from react-paginate.
Any implementation for this?
from react-paginate.
@petertdinh did you ever find a solution or workaround for forcing the page to update within the component?
from react-paginate.
For some reason every number but 0 works for the forcePage property. Is it just me or is this a bug?
from react-paginate.
Related Issues (20)
- Bug
- BUG in initialPage props
- page active link working immediately after clicking before redirecting to that page how to solve this
- pageCount only accepts number but I want to pass a string
- Can't use React <Suspense>? HOT 2
- can i use it in nextjs? HOT 4
- ARIA role should be appropriate for the element HOT 6
- Page active style issue - How to set page 1 as active? HOT 3
- Warning - The pageCount prop value provided is not an integer HOT 12
- Rendering Error HOT 1
- AxeMonitor accessibility issue with react-paginate HOT 1
- Does React-paginate allow you to set the current page?
- Render issues on Next.js 13.5.4 after upgrading from 13.4.12 HOT 37
- How to add custom pageviews
- module tippy not found
- render issue on [email protected] HOT 1
- next/previousLabel keep unused li in DOM
- Props applying to same elements. HOT 1
- Error: Super expression must either be null or a function HOT 1
- Accessing to ref HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-paginate.