I have the following code in my Backbone Collection
loadMore: function() {
this.offset += 1;
this.fetch({
data: {
limit: 50,
skip: this.offset
},
remove: false,
success: function(collection) {
var collectionSize = collection.length;
console.log(collectionSize);
if (collectionSize < this.sizeLimit) {
this.add(collection);
} else {
eventer.trigger('products:end');
}
}.bind(this)
});
}
The this.sizeLimit
is hard coded (for testing) to 150, but products continue to be added to the collection even though the collectionSize
will grow greater than the limit.