Any pagination generator out there? Similiar to will_paginate

I need a pagination for my app, any quick generator out there?

1 Like

Not that I know of, but I’m working on a tutorial on how to add it. Expect to publish next week

3 Likes

I love being part of this community, always holding my back

Looking forward to your cookbook example

1 Like

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.

2 Likes

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!

1 Like

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.

3 Likes

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 :slight_smile:

@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.

1 Like

Absolutely, if that’s what everyone wants.

(Rest of the answer has been moved to its own topic)

Show & Tell topic created: