Skip to content

Pagination example with page total and page number #118

Closed
@exit99

Description

@exit99

I've successfully implemented offset/limit based pagination, see below. But I need a page where the user can jump between the various pages, so I need to know the total items, as well as current page. Cursor based pagination doesn't do this either, as it only knows the last and next page. Can an example be provided for how to do this page type of pagination? Is it possible?

 def resolve_tickets(self, info, **kwargs):
        offset = kwargs.pop('offset', 0)
        limit = kwargs.pop('limit', 10)
        return TicketType.get_query(info).filter_by(**kwargs).offset(offset).limit(limit).all()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions