couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deathbearbrown <...@git.apache.org>
Subject [GitHub] couchdb pull request: New pagination
Date Mon, 03 Mar 2014 17:53:31 GMT
Github user deathbearbrown commented on a diff in the pull request:

    https://github.com/apache/couchdb/pull/162#discussion_r10220337
  
    --- Diff: src/fauxton/app/addons/documents/routes.js ---
    @@ -345,14 +376,62 @@ function(app, FauxtonAPI, Documents, Databases) {
           }));
         },
     
    -    paginate: function (direction) {
    -      _.extend(this.documentsView.collection.params, app.getParams());
    +    perPageChange: function (perPage) {
    +      var params = app.getParams();
    +      this.perPage = perPage;
    +      this.documentsView.updatePerPage(perPage);
    +      this.documentsView.forceRender();
    +      params.limit = perPage;
    +      this.documentsView.collection.params = params;
    +      this.setDocPerPageLimit(perPage);
    +    },
    +
    +    paginate: function (options) {
    +      var params = {},
    +          urlParams = app.getParams(),
    +          collection = this.documentsView.collection;
    +
           this.documentsView.forceRender();
    -      if (direction === 'next') {
    -        this.documentsView.collection.skipFirstItem = true;
    +      var rawCollection = collection.map(function (item) { return item.toJSON(); });
    +
    +      // this is really ugly. But we basically need to make sure that
    +      // all parameters are in the correct state and have been parsed before we
    +      // calculate how to paginate the collection
    +      _.each(['startkey', 'endkey', 'key'], function (key) {
    --- End diff --
    
    can you pull this out into it's own function?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message