Skip to content
This repository has been archived by the owner on Jul 4, 2021. It is now read-only.

Commit

Permalink
Fix #20, #21, #22, #23, #25, #26 and #28
Browse files Browse the repository at this point in the history
  • Loading branch information
wyuenho committed Jan 17, 2013
1 parent 4802f63 commit 2a9246c
Show file tree
Hide file tree
Showing 14 changed files with 1,876 additions and 9,779 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -25,7 +25,7 @@ clean:

doc:
jsduck $(JS_FILE) \
--external=Backbone.Model,Backbone.Collection,jQuery.jqXHR \
--external=Backbone.Model,Backbone.Collection,XMLHttpRequest \
--title=backbone-pageable \
--no-source \
--categories=categories.json \
Expand Down
51 changes: 39 additions & 12 deletions README.rst
Expand Up @@ -203,15 +203,16 @@ unusual circumstances where you need to modify the ``state`` object directly, a
sanity check will be performed at the next time you perform any
pagination-specific operations to ensure internal state consistency.

================== ===============================
Method Use When
================== ===============================
``setPageSize`` Changing the page size
``setSorting`` Changing the sorting
``switchMode`` Switching between modes
``state`` Need to read the internal state
``get*Page`` Need to go to a different page
================== ===============================
======================== ===============================================
Method Use When
======================== ===============================================
``setPageSize`` Changing the page size
``setSorting`` Changing the sorting
``switchMode`` Switching between modes
``state`` Need to read the internal state
``get*Page`` Need to go to a different page
``hasPrevious, hasNext`` Check if paging backward or forward is possible
======================== ===============================================

In addition to the above methods, you can also synchronize the state with the
server during a fetch. ``Backbone.PageableCollection`` overrides the default
Expand Down Expand Up @@ -329,12 +330,31 @@ links are available in the ``links`` field.

.. code-block:: javascript
var Issue = Backbone.Model.extend({});
var Issues = Backbone.PageableCollection.extend({
model: Issue,
url: "https://api.github.com/repos/documentclound/backbone/issues?state=closed",
mode: "infinite"
// Initial pagination states
state: {
pageSize: 15,
sortKey: "updated",
order: 1
},
// You can remap the query parameters from ``state`` keys from the default
// to those your server supports. Setting ``null`` on queryParams removed them
// from being appended to the request URLs.
queryParams: {
totalPages: null,
totalRecords: null,
sortKey: "sort",
order: "direction",
directions: {
"-1": "asc",
"1": "desc"
}
}
});
var issues = new Issues();
Expand Down Expand Up @@ -510,6 +530,13 @@ FAQ
Change Log
----------

1.1 (In Progress)
Bugs Fixed
- Lots of fixes for infinite paging.
Enhancements
- Introduced ``hasPrevious`` and ``hasNext`` for checking if the pageable
collection can be paged backward or forward.

1.0
Bugs Fixed
- Regression from 0.9.9 where ``mode`` wasn't saved after called ``switchMode``.
Expand Down
Expand Up @@ -64,16 +64,6 @@ Docs = {
},
"sort": 3
},
{
"name": "links",
"fullName": "Backbone.PageableCollection.links",
"icon": "icon-property",
"url": "#!/api/Backbone.PageableCollection-property-links",
"meta": {
"readonly": true
},
"sort": 3
},
{
"name": "fullCollection",
"fullName": "Backbone.PageableCollection.fullCollection",
Expand Down Expand Up @@ -142,6 +132,24 @@ Docs = {
},
"sort": 3
},
{
"name": "hasPrevious",
"fullName": "Backbone.PageableCollection.hasPrevious",
"icon": "icon-method",
"url": "#!/api/Backbone.PageableCollection-method-hasPrevious",
"meta": {
},
"sort": 3
},
{
"name": "hasNext",
"fullName": "Backbone.PageableCollection.hasNext",
"icon": "icon-method",
"url": "#!/api/Backbone.PageableCollection-method-hasNext",
"meta": {
},
"sort": 3
},
{
"name": "getFirstPage",
"fullName": "Backbone.PageableCollection.getFirstPage",
Expand Down Expand Up @@ -192,6 +200,16 @@ Docs = {
},
"sort": 3
},
{
"name": "sync",
"fullName": "Backbone.PageableCollection.sync",
"icon": "icon-method",
"url": "#!/api/Backbone.PageableCollection-method-sync",
"meta": {
"chainable": true
},
"sort": 3
},
{
"name": "parseLinks",
"fullName": "Backbone.PageableCollection.parseLinks",
Expand Down
2 changes: 1 addition & 1 deletion api/index.html
Expand Up @@ -12,7 +12,7 @@
<link rel="stylesheet" href="resources/css/app-1dec1b800f7fee208bc8260fa2fd1d22.css" type="text/css" />

<script type="text/javascript" src="extjs/ext-all.js"></script>
<script type="text/javascript" src="data-4df10a953a668bcf0271051e503940e9.js"></script>
<script type="text/javascript" src="data-b94981c4e2d598c193acb48d0dfdfb99.js"></script>

<script type="text/javascript" src="app-c6fdef5b424714d909c92c47a65b7a8f.js"></script>

Expand Down
38 changes: 27 additions & 11 deletions api/output/Backbone.PageableCollection.js

Large diffs are not rendered by default.

0 comments on commit 2a9246c

Please sign in to comment.