Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery requestNextPage()不是Backbone.Paginate中的函数_Jquery_Jquery Ui_Backbone.js_Backbone.js Collections_Backbone.paginator - Fatal编程技术网

Jquery requestNextPage()不是Backbone.Paginate中的函数

Jquery requestNextPage()不是Backbone.Paginate中的函数,jquery,jquery-ui,backbone.js,backbone.js-collections,backbone.paginator,Jquery,Jquery Ui,Backbone.js,Backbone.js Collections,Backbone.paginator,我正在写一个需要分页的主干集合。这是我的代码 define([ 'underscore', 'backbone', 'models/object', 'backbone_paginate' ], function(_, Backbone, Object){ "use strict"; var myCollection= Backbone.Paginator.clientPager.extend({ model: Object, pagina

我正在写一个需要分页的主干集合。这是我的代码

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();
});
我的观点是这样的:

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;
});
现在在我看来,我正在调用:fetch()

一旦抓取成功,我将尝试调用这个.collection.requestNextPage()

它在fetch()之前可以正常工作,但一旦它命中requestNextPage函数(位于showMoreData()函数中),它就会抛出一个错误,指出requestNextPage()不是函数


我不知道我哪里出错了。

requestNextPage(选项)
Paginator.requestPager
上的一种方便方法,但您正在扩展
Paginator.clientPager
。看起来您需要使用
nextPage()

来共享您所引用的其他源代码吗?听起来这可能就是错误所在。