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

Feature request: Torso Paginated Collection #318

Open
diokey opened this issue Apr 13, 2017 · 1 comment
Open

Feature request: Torso Paginated Collection #318

diokey opened this issue Apr 13, 2017 · 1 comment

Comments

@diokey
Copy link
Contributor

diokey commented Apr 13, 2017

When you have paginated REST APIs, It would be nice to have a collection that can be configured to fetch paginated data

var visitCollections = (Torso.PaginatedCollection.extend({
  url: "/visit",
  // define paging configuration
  paging: {
    pageSize: 10,
    pageNumber: 0		
  }
}))();

var visits = visitCollection.createPrivateCollection();
						
visits.getFirstPage();
visits.getLastPage();
visits.getPreviousPage();
visits.getNextPage();
visits.getPage(pageNumber);

We may also want to add sorting

@kentmw
Copy link
Contributor

kentmw commented Apr 13, 2017

You've identified the need for the paging to be done on the private collection. That's true. But the paging options should be defined by the private collection as well, as paging is situationally dependent (one form on one page paging with some size and another somewhere else with a different size). Right now, it feels like the api you have for private collections seem pretty good and then if we add the ability to configure page size and a separate url (or GET parameters to narrow the cache's url query) to find the ids it cares about. Now that I've written that out, I think it should always be a different url, because the private collection deals with ids and the cache's url deals with objects.

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