Back

how to implement cursor pagination

  • 0
  • Databases
  • Web
  • Cloud
#fef9ef
3 Sep, 2023, 13:17

hi, I'm try to implement cursor pagination by look through the appwrite document and i still don't get it, could anyone send link any example code about it ?

TL;DR
User is seeking help on implementing cursor pagination. They express confusion and doubt about its usefulness. They ask for clarification on how to implement it and for example code. Unfortunately, no solution is provided in the thread. However, the user is directed to an example code on cursor pagination that could be helpful.
darShan
3 Sep, 2023, 13:27

You can check this example, should give you a gist - https://dev.to/appwrite/this-is-why-you-should-use-cursor-pagination-4nh5

#fef9ef
3 Sep, 2023, 13:42

i already check it and still don't get it, what i need an example code how to implement a real project

D5
3 Sep, 2023, 13:45

What you don't understand, basically triggering your get documents and in the query specify the page where you are

#fef9ef
3 Sep, 2023, 14:00

I'm using this package https://terryz.github.io/vue3/page/#page-size-menu and i'm trying to implement it with cursor paginator, what i don't understand step process like when user click on previous or next

D5
3 Sep, 2023, 14:23

When you click page 2, get documents as usually, with the difference you specify in your query this: Query.offset(0)

D5
3 Sep, 2023, 14:23

1 if you're in page 1, 2 if in page 2...

#fef9ef
3 Sep, 2023, 14:52

i don't get it, why offset ?

D5
3 Sep, 2023, 14:55

Offset = page

#fef9ef
3 Sep, 2023, 14:59

i'm try to implement cursor pagination not offset

D5
3 Sep, 2023, 15:17

Then you get latest document id and that way you get next elements

#fef9ef
4 Sep, 2023, 06:46

how about previous ?

#fef9ef
5 Sep, 2023, 15:09

anyone implement this ?

D5
5 Sep, 2023, 15:12

First element you just don't set pagination query so you will get first 24 documents

#fef9ef
5 Sep, 2023, 15:18

example : i have 3 pages , i click on page 3 and then i click on page 2 , how the query work ?

D5
5 Sep, 2023, 15:55

For that you need standard pagination then

D5
5 Sep, 2023, 15:55

Cursor pagination is for example to make an infinite scrolling screen

D5
5 Sep, 2023, 15:56

You can implement too cursor pagination there, but I think it's worthless

#fef9ef
5 Sep, 2023, 16:02

why is it worthless ?

D5
5 Sep, 2023, 16:12

You will need to perform multiple queries so It will take practically the same time

D5
5 Sep, 2023, 16:13

In other words you will not have practically any advantage

#fef9ef
5 Sep, 2023, 16:30

ok, noted, thank you so much.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more