diff options
author | John Christopher Anderson <jchris@apache.org> | 2009-02-09 01:00:33 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2009-02-09 01:00:33 +0000 |
commit | 3132843214251e3a68b7b3fe89618d323dffa546 (patch) | |
tree | d89e377fb853b51b3d780de508d3699d9867f845 /share/www | |
parent | 3d5351adb31fea59400179f85fb2dd97b7028ddb (diff) |
row_info object for _list pagination. Thanks benoitc.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@742220 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www')
-rw-r--r-- | share/www/script/couch_tests.js | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js index dd070958..2df262d7 100644 --- a/share/www/script/couch_tests.js +++ b/share/www/script/couch_tests.js @@ -2677,13 +2677,13 @@ db.createDb(); } }, lists: { - simpleForm: stringFun(function(head, row, req, row_number) { + simpleForm: stringFun(function(head, row, req, row_info) { if (row) { // we ignore headers on rows and tail return { body : '\n<li>Key: '+row.key +' Value: '+row.value - +' LineNo: '+row_number+'</li>' + +' LineNo: '+row_info.row_number+'</li>' }; } else if (head) { // we return an object (like those used by external and show) @@ -2696,10 +2696,12 @@ db.createDb(); }; } else { // tail - return {body : '</ul>'}; + return {body : '</ul>'+ + '<p>FirstKey: '+row_info.first_key+ + ' LastKey: '+row_info.prev_key+'</p>'}; } }), - acceptSwitch: stringFun(function(head, row, req, row_number) { + acceptSwitch: stringFun(function(head, row, req, row_info) { return respondWith(req, { html : function() { // If you're outputting text and you're not setting @@ -2709,9 +2711,10 @@ db.createDb(); } else if (row) { return '\n<li>Key: ' +row.key+' Value: '+row.value - +' LineNo: '+row_number+'</li>'; + +' LineNo: '+row_info.row_number+'</li>'; } else { // tail - return "</ul>"; + return '</ul>'; + } }, xml : function() { @@ -2754,6 +2757,9 @@ db.createDb(); T(/Key: 1/.test(xhr.responseText)); T(/LineNo: 0/.test(xhr.responseText)); T(/LineNo: 5/.test(xhr.responseText)); + T(/FirstKey: 0/.test(xhr.responseText)); + T(/LastKey: 9/.test(xhr.responseText)); + var lines = xhr.responseText.split('\n'); T(/LineNo: 5/.test(lines[6])); @@ -2763,6 +2769,9 @@ db.createDb(); T(xhr.status == 200); T(/Total Rows/.test(xhr.responseText)); T(!(/Key: 1/.test(xhr.responseText))); + T(/FirstKey: 3/.test(xhr.responseText)); + T(/LastKey: 9/.test(xhr.responseText)); + // with 0 rows var xhr = CouchDB.request("GET", "/test_suite_db/_list/lists/simpleForm/basicView?startkey=30"); |