I need a pagination for my app, any quick generator out there?
Not that I know of, but I’m working on a tutorial on how to add it. Expect to publish next week
I love being part of this community, always holding my back
Looking forward to your cookbook example
Take a look at Apollo pagination: https://www.apollographql.com/docs/react/data/pagination/
The basic offset based one should be compatible with Prisma. Of course, you need to build the server Prisma part and a React component using this data yourself.
Has anyone found the Prisma docs helpful?
Is having a generator do code mod a thing? For example, imagine I have a service for posts, would it be acceptable to run yarn rw g paginate posts
and then it mods my service to have a query that adds a function in there with a paginated query (using Prisma)?
If not, is the correct solution to adjust the current generator to include pagination by default? Should a new cell exist that is a “PaginatedCell”?
A few generators already do modify code: deploy and tailwind for example.
What you just described would be rad!
The example blog has pagination! There’s no generator but you could copy/paste! Here’s the component and it’s used like this on the component that would show page numbers.
Basically, it sends page
and limit
params through [GraphQL]((https://github.com/redwoodjs/example-blog/blob/main/web/src/components/Blog/Pagination/Pagination.js) which then get turned into skip
and take
for Prisma in the service.
https://tlundberg.com/blog/2020-09-16/redwood-pagination-tutorial/
I have a few tweaks I want to make before I post about it in “Show & Tell”, but if anyone here wants to do a run through and provide feedback that would be awesome
@Tobbe Could you turn into cookbook exemple. It would improve the accessibility of this tutorial I’m pretty sure many people want to have some help in this area.
Absolutely, if that’s what everyone wants.
(Rest of the answer has been moved to its own topic)
Show & Tell topic created: