Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinity model allow skip-like pagination #122

Closed
teckays opened this issue Dec 15, 2015 · 5 comments
Closed

Infinity model allow skip-like pagination #122

teckays opened this issue Dec 15, 2015 · 5 comments

Comments

@teckays
Copy link

teckays commented Dec 15, 2015

I don't know if it currently supports, could not find anything about it in the documentation, but would be great if it would support skip-like pagination. What I mean is that some of the api backends do not accept pationation like 1, 2, 3, etc. it works with skip. Example: (asuming you have 20 items per page) then 20, 40, 60, etc..

@teckays
Copy link
Author

teckays commented Dec 15, 2015

For now I solved this using this hack by overriding the _buildParams inside my router:

_buildParams: function(nextPage){
    nextPage = (nextPage - 1) * perPage;
    return this._super(nextPage);
  }

A more elegant, built-in solution is needed!

@hhff
Copy link
Collaborator

hhff commented Dec 15, 2015

We've got support for this - you can do this in a nicer way using boundParams and the afterInfinityModel hook - or by overriding the extractMeta hook in your serializer to convert your limit into "pages"

@teckays
Copy link
Author

teckays commented Dec 20, 2015

@hhff thank you, I will give this a try, however I have expected a config-like way of defining this. Anyway, will work for now.

@teckays teckays closed this as completed Dec 20, 2015
@kellyselden
Copy link
Collaborator

@teckays We are always open to doing things better/different if the right idea/PR comes along 😄

@hhff
Copy link
Collaborator

hhff commented Dec 20, 2015

💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants