diff options
author | Garren Smith <garren.smith@gmail.com> | 2013-10-11 12:03:50 +0200 |
---|---|---|
committer | Garren Smith <garren.smith@gmail.com> | 2013-10-11 12:03:50 +0200 |
commit | 29389322defc6c950be2f8bdd424f289749e9847 (patch) | |
tree | 8a5c7a11a891c5bfa1ba947c62df6c8256c41cb8 | |
parent | 4aa8955ca631c46a8375c40966c058d06a21141e (diff) | |
download | couchdb-1760-fauxton-correct-row-message.tar.gz |
Fix bug when delete all docs on page1760-fauxton-correct-row-message
-rw-r--r-- | src/fauxton/app/modules/documents/resources.js | 8 | ||||
-rw-r--r-- | src/fauxton/app/modules/fauxton/components.js | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/fauxton/app/modules/documents/resources.js b/src/fauxton/app/modules/documents/resources.js index 4f75daaab..f80aeefb6 100644 --- a/src/fauxton/app/modules/documents/resources.js +++ b/src/fauxton/app/modules/documents/resources.js @@ -278,7 +278,13 @@ function(app, FauxtonAPI) { urlNextPage: function (num, lastId) { if (!lastId) { - lastId = this.last().id; + var doc = this.last(); + + if (doc) { + lastId = doc.id; + } else { + lastId = ''; + } } this.params.startkey_docid = '"' + lastId + '"'; diff --git a/src/fauxton/app/modules/fauxton/components.js b/src/fauxton/app/modules/fauxton/components.js index 09dcc51fc..03fea872c 100644 --- a/src/fauxton/app/modules/fauxton/components.js +++ b/src/fauxton/app/modules/fauxton/components.js @@ -73,7 +73,12 @@ function(app, FauxtonAPI) { nextClicked: function (event) { event.preventDefault(); - this.previousIds.push(this.collection.first().id); + var doc = this.collection.first(); + + if (doc) { + this.previousIds.push(doc.id); + } + FauxtonAPI.navigate(this.nextUrlfn(), {trigger: false}); FauxtonAPI.triggerRouteEvent('paginate', 'next'); }, |