I'm following the docs,
https://appwrite.io/docs/pagination#cursor-pagination, so do I need to write the code again and again for each page?
And I'm getting an error saying Cannot read properties of undefined (reading 'length')
this is my function
"647ac763cf53edxxxxx",
"647ac820ba3852xxxxx",
[
Query.orderDesc("age"),
Query.notEqual("age", ["invalid"]),
Query.limit(25)
]
);
const lastId = page1.documents[page1.documents.length - 1].$id;
// Page 2
const page2 = databases.listDocuments(
'647ac763cf53edxxxxx',
'647ac820ba3852xxxxx',
[
Query.limit(25),
Query.cursorAfter(lastId),
]
);
page1.then(function (response) {
console.log(response.documents);
var tableHTML = generateTable(response.documents);
var tableContainer = document.getElementById('tableContainer');
tableContainer.innerHTML = tableHTML;
}, function (error) {
console.log(error);
});
page2.then(function (response) {
console.log(response.documents);
var tableHTML = generateTable(response.documents);
var tableContainer = document.getElementById('tableContainer');
tableContainer.innerHTML = tableHTML;
}, function (error) {
console.log(error);
});```
I highly suggest you do some research or tutorials on promises to understand how they work and how to use them
I solved my error, thanks🫡
Recommended threads
- Issue with relations on database
I'm creating a food ordering website for businesses. I'm having issues with the relations on my database I attached the attributes for the collections I'm hav...
- The current user is not authorized to pe...
I want to create a document associated with user after log in with OAuth. The user were logged in, but Appwrite said user is unauthorized. User is logged in wi...
- self-hosted auth: /v1/account 404 on saf...
Project created in React/Next.js, Appwrite version 1.6.0. Authentication works in all browsers except Safari (ios), where an attempt to connect to {endpoint}/v1...