Closed missmatsuko closed 5 years ago
We just released Element API 2.6.0 with added support for the offset
criteria param:
'criteria' => [
'offset' => 4,
// ...
],
With that in place, the first 4 items would never be included in the results.
Is it possible to paginate a query with offset? https://craftcms.stackexchange.com/questions/19924/how-to-skip-the-first-x-entries-using-elementapi
My use case is that I'm adding items to a page. The page loads with 4 items (1 row of 1, 1 row of 3) then paginates with 6 items (2 rows of 3) so I can't just paginate and start from the second page.
I found that offset works if
paginate
is set tofalse
, but then it's trickier to figure out if I've reached the end of results.I have figured out that I can still use pagination if I exclude IDs in criteria, so currently I'm thinking to pass the IDs of the first 4 items into my endpoint and exclude those.