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

Filtered length when paginating #11

Closed
jmorrell opened this issue Jan 22, 2014 · 4 comments
Closed

Filtered length when paginating #11

jmorrell opened this issue Jan 22, 2014 · 4 comments

Comments

@jmorrell
Copy link
Owner

Currently there is no way of knowing how many models are in the collection after filtering if you're also paginating. This is definitely information you may want to show in the UI.

@jmorrell
Copy link
Owner Author

Perhaps an extension to the paginated collection would be helpful here: getUnpaginatedLength() or something along those lines?

@marcfalk
Copy link

Yep, would totally make sense in my world.

For anyone else stopping by, I'll include the line you posted on Twitter, thanks :)

"proxy._filtered.length" does the trick for now.

@jmorrell
Copy link
Owner Author

Currently you can access the filtered collection within an obscura collection via _filtered, so you can still get access to it.

var proxy = new Obscura(collection);
proxy.filterBy({ a: 2 });
proxy.setPerPage(10);

collection.length; // the original collection length
proxy.length;  //  the paginated length
proxy._filtered.length; // the filtered length

Though I'd want an official API for this. Should be simple to add.

@jmorrell
Copy link
Owner Author

@marcfalk This should be fixed now :)

var proxy = new Obscura(collection);
proxy.filterBy({ a: 2 });
proxy.setPerPage(10);

collection.length; // the original collection length
proxy.length;  //  the paginated length
proxy.getFilteredLength(); // the filtered length

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

2 participants