gpt4 book ai didi

jquery - 主干分页器未对我的集合进行分页

转载 作者:行者123 更新时间:2023-12-01 01:49:26 25 4
gpt4 key购买 nike

define([
'underscore',
'backbone',
'models/shared_object',
'backbone_paginate'
], function(_, Backbone, Shared_Object){
"use strict";
var myCollection= Backbone.Collection.extend({
initialize: function(option) {
Backbone.Pagination.enable(this,{ipp:2,fetchOptions:{add:true}});
},

model: Shared_Object,
baseUrl: function() {
return location.protocol + '//' + location.host+'/address';
},

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

我有这个集合,我正在尝试对其进行分页,使其每次调用仅获取 2 个项目。如您所见,我有 ipp:2 将每页设置为每页 2 个项目。不过,我不明白为什么它会获取我收藏的所有元素。我的 Parse() 函数有问题吗?

最佳答案

如上所述:

This sounds like a server issue and not a Backbone issue.

Two things to look at:

  1. what params are being sent to the server and is ipp on it?

  2. Check if 'ipp' is indeed being received by the server, and is it doing what it's supposed to, to limit the items sent back to the client.

关于jquery - 主干分页器未对我的集合进行分页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13942664/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com