Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9068825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:17:15+00:00 2026-06-16T17:17:15+00:00

I am writing a backbone collection which requires pagination. So this is my code

  • 0

I am writing a backbone collection which requires pagination. So this is my code

define([
  'underscore',
  'backbone',
  'models/object',
  'backbone_paginate'

], function(_, Backbone, Object){
   "use strict";
  var myCollection= Backbone.Paginator.clientPager.extend({


    model: Object,


      paginator_core: {
          // the type of the request (GET by default)
          type: 'GET',

          // the type of reply (jsonp by default)
          dataType: 'json',

          // the URL (or base URL) for the service
          url: location.protocol + '//' + location.host+'/address'
      },

      paginator_ui: {
          // the lowest page index your API allows to be accessed
          firstPage: 1,

          // which page should the paginator start from
          // (also, the actual page the paginator is on)
          currentPage: 1,

          // how many items per page should be shown
          perPage: 3,

          // a default number of total pages to query in case the API or
          // service you are using does not support providing the total
          // number of pages for us.
          // 10 as a default in case your service doesn't return the total
          totalPages: 10,

          pagesInRange: 3
      },

      server_api: {
           '$top': function() {
               return this.totalPages * this.perPage; },

          },

       parse:function(dat){
      return dat.items;
    }


     });
  return new myCollection();
});

My view looks like this:

define([
  'jquery',
  'underscore',
  'backbone',
   'collections/addressLists',
     'models/object',
     'views/shared_object_item',

], function($, _, Backbone, AddressLists,Address,Shared_object_item){
  "use strict";

  var AppView = Backbone.View.extend({
    events: {

    },



    initialize: function() {

      _.bindAll(this,'render','updateData','showMoreData','showAllData');              this.collection=AddressLists;
     this.collection.bind('reset',this.render);
       this.collection.fetch();


    },

     el:$('div')[0],
     render: function() {

       var that=this;
      $('.innerContainer').bind('scroll',function(){
         if($(this)[0].scrollHeight-$(this).scrollTop()==$(this).outerHeight()){
           that.showMoreData();
          }
      });
        this.updateData();
       },

    updateData:function(){
      var that=this,collection;
      $('.innerItem').empty();

      _.each(this.collection.models,function(model){
         $('.innerItem').append(new Shared_object_item({parent:that,collection:that.collection,model:model}).render().el);
      });

    },
      showMoreData:function(){

this.collection.requestNextPage();

      },
   });
  return AppView;
});

now in my view I am calling : fetch();

and on success of the fetch I am trying to call this.collection.requestNextPage();

It works fine till fetch(), but as soon as it hits the requestNextPage function(which resides in the showMoreData() function ), it throws an error stating that requestNextPage() is not a function.

I dont know wheere am I going wrong here..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:17:17+00:00Added an answer on June 16, 2026 at 5:17 pm

    From the Backbone.Paginator docs requestNextPage(options) is a convenience method on Paginator.requestPager, but you are extending Paginator.clientPager. Looks like you’ll need to use nextPage().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing documentation in html requires some code examples. What to do with characters that
I'm planning on writing a spine/backbone.js style web application which basically just transfers a
I'm currently writing a Backbone Marionette app which ultimately amounts to about 6 different
I'm writing a backbone app, and using the built-in event handling, which uses jquery
I have .js files of the following form: define([ 'jquery', 'backbone' ], function($, Backbone)
I am writing a Backbone application which should interface to a REST API. My
I'm writing a test for a Backbone View to test that the render function
I was trying the backbone.js examples given here and then tried writing some code
Writing Classic ASP code in JScript has a lot going for it: more humane
Writing a python program, and I came up with this error while using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.