loadMore: function(){
var $this = this;
console.log(this.Messages); //SAME AS AFTER
this.Messages.url = '/js/messages/?start=' + this.Messages.length
this.Messages.fetch({'add':true,
success:function(){
console.log($this.Messages); //SAME AS BEFORE??
},
error:function(){
}
});
},
The collection is not updated. After this function, the events are fired, and the new items are drawn on the screen. The problem is that the collection did not add the new models.
As was mentioned in a previous answer the add
option was removed in 1.0.0. You can accomplish the same thing by passing remove: false
instead. From the docs:
The behavior of fetch can be customized by using the available set options. For example, to fetch a collection, getting an "add" event for every new model, and a "change" event for every changed existing model, without removing anything:
collection.fetch({remove: false})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With