Open Induc opened 11 years ago
REST API - Pagination/range support
Collections can contain a huge list of resources. Since the client UI usually shows only a subset of the collection at a time, it is desirable to request subset of a collection for fast retrieval. URL query parameters are used here to request resource ranges. Query parameters:
offset : offset to the resource index. E.g. 100 means the 100th resource in the resource collection
limit : maximum number of resources to return
E.g. offset=20 and limit=10 would return resources 20 through 29.
URL with pagination query
/resource/:id/subresource?offset=20&limit=10
Implementation note:
Backbone’s Collection.fetch() supports jQuery.ajax options to be passed directly as options, so to fetch a specific range of a paginated collection:
Collection.fetch({data: {offset: 20, limit: 10}})
Implement the server side rest API handling first. It should be possible to test this using a test tool such as POSTER plugin on Firefox
server side rest api for pagination .implimented with page and limit
Pagination of Qwizbook list based on "number of items to be dispalyed on a page" that can be selected from a dropdown by user