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

Pagination instead of Page.all #9

Open
GertThiel opened this issue Jun 10, 2012 · 5 comments
Open

Pagination instead of Page.all #9

GertThiel opened this issue Jun 10, 2012 · 5 comments
Labels

Comments

@GertThiel
Copy link

No actual application works w/o pagination.

@inossidabile
Copy link
Member

True. But the guide was not mentioned to create a real-life application. I trust pagination is a good thing to study on yourself to consolidate everything you learned.

@GertThiel
Copy link
Author

After two attempts to implement endless scrolling or pagination I learned that you should not have closed this issue so quickly!

Joosy is actually buggy or at least incomplete because it does not support setting collection related meta data (number of total records available, number of total records of an actual query available.

I got two implementations almost working: Using the jQuery Waypoints plug-in which can not set the total number of records and an integration of the DataTables plug-in which does not integration which Joosy model layer.

@inossidabile
Copy link
Member

For the infinite scroll you don't really require the total number of entities. However I see your point and it makes sense. At Rails there's no real convention about pagination serialization across different gems. Maybe we should introduce it ourselves and add this functionality to the Collections, not sure yet.

Currently it can easily be achieved using beforeFilter and collection instance variables. I will reopen this issue as a reminder for the real pagination sample among advanced guides. Within that I'll describe details. And then, again, I'll consider implementing it as a Collections part. Cause, I agree, it's something that you really are supposed to do often.

@inossidabile inossidabile reopened this Jun 18, 2012
@GertThiel
Copy link
Author

For the infinite scroll you don't really require the total number of entities

If I want to show how many records are available to see, I can't ask the Joosy resource as length() returns the number of loaded models only, not the total number of records in the database.

@GertThiel
Copy link
Author

Currently it can easily be achieved using beforeFilter and collection instance variables …

Why so complicated? The will_paginate gem, Model.paginate(:page => params[:page]), the jQuery Waypoints plug-in and a few lines of code in the IndexPage and I got simple infinite scrolling.

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

No branches or pull requests

2 participants